Sha256: 131a57201a55b36ef33d1109e8b533cfbd8d6e2a4a55988b850fb81fba52b0af

Contents?: true

Size: 714 Bytes

Versions: 8

Compression:

Stored size: 714 Bytes

Contents

module FactoryGirl
  class Decorator
    class ClassKeyHash < Decorator
      def [](key)
        @component[symbolized_key key]
      end

      def []=(key, value)
        @component[symbolized_key key] = value
      end

      def key?(key)
        @component.key? symbolized_key(key)
      end

      private

      def symbolized_key(key)
        if key.respond_to?(:to_sym)
          key.to_sym
        elsif FactoryGirl.allow_class_lookup
          ActiveSupport::Deprecation.warn "Looking up factories by class is deprecated and will be removed in 5.0. Use symbols instead and set FactoryGirl.allow_class_lookup = false", caller
          key.to_s.underscore.to_sym
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
ffactory_girl-4.8.2 lib/factory_girl/decorator/class_key_hash.rb
factory_girl-4.9.0 lib/factory_girl/decorator/class_key_hash.rb
ffactory_girl-4.8.1 lib/factory_girl/decorator/class_key_hash.rb
factory_girl-4.8.1 lib/factory_girl/decorator/class_key_hash.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/factory_girl-4.8.0/lib/factory_girl/decorator/class_key_hash.rb
factory_girl-4.8.0 lib/factory_girl/decorator/class_key_hash.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/factory_girl-4.7.0/lib/factory_girl/decorator/class_key_hash.rb
factory_girl-4.7.0 lib/factory_girl/decorator/class_key_hash.rb