Class: FactoryGirl::Proxy::AttributesFor

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from FactoryGirl::Proxy

#callbacks

Instance Method Summary collapse

Methods inherited from FactoryGirl::Proxy

#add_callback, #associate, #association, #method_missing, #run_callbacks, #set_ignored

Constructor Details

#initialize(klass) ⇒ AttributesFor

Returns a new instance of AttributesFor.



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

def initialize(klass)
  super(klass)
  @hash = {}
  @ignored_attributes = {}
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



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

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

#result(to_create) ⇒ Object



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

def result(to_create)
  @hash
end

#set(attribute, value) ⇒ Object



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

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