Class: FactoryGirlStepHelpers::HumanHashToAttributeHash Private

Inherits:
Object
  • Object
show all
Defined in:
lib/factory_girl/step_definitions.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: AssociationManager, AttributeStrategy, CreateAttributes, FindAttributes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(human_hash, associations) ⇒ HumanHashToAttributeHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HumanHashToAttributeHash.



10
11
12
13
# File 'lib/factory_girl/step_definitions.rb', line 10

def initialize(human_hash, associations)
  @human_hash   = human_hash
  @associations = associations
end

Instance Attribute Details

#associationsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/factory_girl/step_definitions.rb', line 8

def associations
  @associations
end

Instance Method Details

#attributes(strategy = CreateAttributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
# File 'lib/factory_girl/step_definitions.rb', line 15

def attributes(strategy = CreateAttributes)
  @human_hash.inject({}) do |attribute_hash, (human_key, value)|
    attributes = strategy.new(self, *process_key_value(human_key, value))
    attribute_hash.merge({ attributes.key => attributes.value })
  end
end