Navigation Menu

Skip to content

Commit

Permalink
Clean up method names
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Oct 20, 2011
1 parent 105d972 commit 369b4b9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/factory_girl/factory.rb
Expand Up @@ -205,7 +205,7 @@ def run(overrides = {})

apply_callbacks
apply_attributes
apply_remaining_attributes
apply_remaining_overrides

proxy.result(@to_create)
end
Expand All @@ -221,18 +221,22 @@ def apply_callbacks
def apply_attributes
@attributes.each do |attribute|
if overrides_for_attribute(attribute).any?
handle_overrides(attribute)
handle_attribute_with_overrides(attribute)
else
handle_attribute_without_overrides(attribute)
end
end
end

def apply_remaining_overrides
@overrides.each { |attr, val| proxy.set(attr, val) }
end

def overrides_for_attribute(attribute)
@overrides.select { |attr, val| attribute.aliases_for?(attr) }
end

def handle_overrides(attribute)
def handle_attribute_with_overrides(attribute)
overrides_for_attribute(attribute).each do |attr, val|
if attribute.ignored
proxy.set_ignored(attr, val)
Expand All @@ -248,10 +252,6 @@ def handle_attribute_without_overrides(attribute)
attribute.add_to(proxy)
end

def apply_remaining_attributes
@overrides.each { |attr, val| proxy.set(attr, val) }
end

def proxy
@proxy ||= @proxy_class.new(@build_class)
end
Expand Down

0 comments on commit 369b4b9

Please sign in to comment.