Sha256: d6066afdd715bbca24c040e70c7a552d7bf0fba377e627ba727567252a307b00

Contents?: true

Size: 489 Bytes

Versions: 53

Compression:

Stored size: 489 Bytes

Contents

module FactoryGirl
  # @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)
      if respond_to?(name)
        nil
      else
        super
      end
    end

    def respond_to?(method, include_private=false)
      @methods_to_respond_to.include? method.to_s
    end

    def respond_to_missing?(*args)
      false
    end
  end
end

Version data entries

53 entries across 41 versions & 11 rubygems

Version Path
ffactory_girl-4.8.2 lib/factory_girl/null_object.rb
factory_girl-4.9.0 lib/factory_girl/null_object.rb
ffactory_girl-4.8.1 lib/factory_girl/null_object.rb
factory_girl-4.8.1 lib/factory_girl/null_object.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/factory_girl-4.8.0/lib/factory_girl/null_object.rb
factory_girl-4.8.0 lib/factory_girl/null_object.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/factory_girl-4.7.0/lib/factory_girl/null_object.rb
factory_girl-4.7.0 lib/factory_girl/null_object.rb
opal-factory_girl-4.5.0.3 factory_girl/lib/factory_girl/null_object.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/factory_girl-4.5.0/lib/factory_girl/null_object.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/null_object.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/null_object.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/lib/factory_girl/null_object.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/null_object.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/lib/factory_girl/null_object.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/lib/factory_girl/null_object.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/lib/factory_girl/null_object.rb
factory_girl-4.5.0 lib/factory_girl/null_object.rb
factory_girl-4.4.0 lib/factory_girl/null_object.rb
factory_girl-4.3.0 lib/factory_girl/null_object.rb