class FactoryBot::NullObject

@api private

Public Class Methods

new(methods_to_respond_to) click to toggle source
# File lib/factory_bot/null_object.rb, line 4
def initialize(methods_to_respond_to)
  @methods_to_respond_to = methods_to_respond_to.map(&:to_s)
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/factory_bot/null_object.rb, line 8
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
  if respond_to?(name)
    nil
  else
    super
  end
end
respond_to?(method) click to toggle source
# File lib/factory_bot/null_object.rb, line 16
def respond_to?(method)
  @methods_to_respond_to.include? method.to_s
end