Class: FactoryGirl::Proxy::AttributesFor

Inherits:
FactoryGirl::Proxy show all
Defined in:
lib/factory_girl/proxy/attributes_for.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from FactoryGirl::Proxy

#associate, #association, ensure_strategy_exists!, #method_missing, #run_callbacks, #set_ignored

Constructor Details

#initialize(klass, callbacks = []) ⇒ AttributesFor

Returns a new instance of AttributesFor.



4
5
6
7
# File 'lib/factory_girl/proxy/attributes_for.rb', line 4

def initialize(klass, callbacks = [])
  super
  @hash = {}
end

Dynamic Method Handling

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

Instance Method Details

#get(attribute) ⇒ Object



9
10
11
# File 'lib/factory_girl/proxy/attributes_for.rb', line 9

def get(attribute)
  @ignored_attributes[attribute] || @hash[attribute]
end

#result(to_create) ⇒ Object



17
18
19
# File 'lib/factory_girl/proxy/attributes_for.rb', line 17

def result(to_create)
  @hash
end

#set(attribute, value) ⇒ Object



13
14
15
# File 'lib/factory_girl/proxy/attributes_for.rb', line 13

def set(attribute, value)
  @hash[attribute] = value
end