Sha256: fb610ace2da2494c27000d55c96d87de6bd5fbaf9b4334b6bfac903452020b8c

Contents?: true

Size: 387 Bytes

Versions: 28

Compression:

Stored size: 387 Bytes

Contents

module FactoryBot
  class Decorator
    class AttributeHash < Decorator
      def initialize(component, attributes = [])
        super(component)
        @attributes = attributes
      end

      def attributes
        @attributes.each_with_object({}) do |attribute_name, result|
          result[attribute_name] = @component.send(attribute_name)
        end
      end
    end
  end
end

Version data entries

28 entries across 27 versions & 3 rubygems

Version Path
factory_bot-5.1.2 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.1.1 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.1.0 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.0.2 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.0.1 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.0.0 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.0.0.rc2 lib/factory_bot/decorator/attribute_hash.rb
factory_bot-5.0.0.rc1 lib/factory_bot/decorator/attribute_hash.rb