Class: FloorManager::Employee::DSL::AssocProxy
- Inherits:
-
Object
- Object
- FloorManager::Employee::DSL::AssocProxy
- Defined in:
- lib/floor_manager/employee/dsl.rb
Overview
A proxy that is the receiver of #set and #append in a construct like this:
one :spy do
relationship.set :gun
end
Instance Method Summary collapse
- #append(*create_args) ⇒ Object
- #integer(range) ⇒ Object
- #set(*create_args) ⇒ Object
- #string(chars = 10) ⇒ Object
Instance Method Details
#append(*create_args) ⇒ Object
15 16 17 |
# File 'lib/floor_manager/employee/dsl.rb', line 15 def append(*create_args) dsl._add_attribute AttributeAction::AssocAppend.new(field, create_args) end |
#integer(range) ⇒ Object
23 24 25 26 27 |
# File 'lib/floor_manager/employee/dsl.rb', line 23 def integer(range) dsl._add_attribute AttributeAction::Block.new(field, proc { range.first + rand(range.last-range.first) }) end |
#set(*create_args) ⇒ Object
12 13 14 |
# File 'lib/floor_manager/employee/dsl.rb', line 12 def set(*create_args) dsl._add_attribute AttributeAction::AssocSet.new(field, create_args) end |
#string(chars = 10) ⇒ Object
18 19 20 21 22 |
# File 'lib/floor_manager/employee/dsl.rb', line 18 def string(chars=10) dsl._add_attribute AttributeAction::Block.new(field, proc { (0...chars).map{ ('a'..'z').to_a[rand(26)] }.join }) end |