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.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (HumanHashToAttributeHash) initialize(human_hash, associations)

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.

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

- (Object) associations (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

- (Object) attributes(strategy = CreateAttributes)

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