Class: FactoryGirl::Decorator::AttributeHash

Inherits:
FactoryGirl::Decorator show all
Defined in:
lib/factory_girl/decorator/attribute_hash.rb

Instance Method Summary collapse

Methods inherited from FactoryGirl::Decorator

const_missing, #method_missing, #send

Constructor Details

#initialize(component, attributes = []) ⇒ AttributeHash

Returns a new instance of AttributeHash.



4
5
6
7
# File 'lib/factory_girl/decorator/attribute_hash.rb', line 4

def initialize(component, attributes = [])
  super(component)
  @attributes = attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FactoryGirl::Decorator

Instance Method Details

#attributesObject



9
10
11
12
13
# File 'lib/factory_girl/decorator/attribute_hash.rb', line 9

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