Sha256: c675de56af3bafae57f0ec99ed4bf1d531c6c5467fb02e5303f28ccf958c0f93

Contents?: true

Size: 457 Bytes

Versions: 16

Compression:

Stored size: 457 Bytes

Contents

module FactoryBot
  # @api private
  class NullObject < ::BasicObject
    def initialize(methods_to_respond_to)
      @methods_to_respond_to = methods_to_respond_to.map(&:to_s)
    end

    def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
      if respond_to?(name)
        nil
      else
        super
      end
    end

    def respond_to?(method)
      @methods_to_respond_to.include? method.to_s
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
factory_bot-6.5.0 lib/factory_bot/null_object.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/factory_bot-6.4.6/lib/factory_bot/null_object.rb
factory_bot-6.4.6 lib/factory_bot/null_object.rb
factory_bot-6.4.5 lib/factory_bot/null_object.rb
factory_bot-6.4.4 lib/factory_bot/null_object.rb
factory_bot-6.4.3 lib/factory_bot/null_object.rb
factory_bot-6.4.2 lib/factory_bot/null_object.rb
factory_bot-6.4.1 lib/factory_bot/null_object.rb
factory_bot-6.4.0 lib/factory_bot/null_object.rb
factory_bot-6.3.0 lib/factory_bot/null_object.rb
factory_bot-6.2.1 lib/factory_bot/null_object.rb
factory_bot-6.2.0 lib/factory_bot/null_object.rb
factory_bot-6.1.0 lib/factory_bot/null_object.rb
factory_bot-6.0.2 lib/factory_bot/null_object.rb
factory_bot-6.0.1 lib/factory_bot/null_object.rb
factory_bot-6.0.0 lib/factory_bot/null_object.rb