Class: Machinist::DataMapper::Lathe
- Inherits:
-
Lathe
- Object
- Lathe
- Machinist::DataMapper::Lathe
- Defined in:
- lib/machinist/data_mapper/lathe.rb
Instance Method Summary collapse
-
#make_association(attribute, args) ⇒ Object
:nodoc:.
-
#make_one_value(attribute, args) ⇒ Object
:nodoc:.
Instance Method Details
#make_association(attribute, args) ⇒ Object
:nodoc:
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/machinist/data_mapper/lathe.rb', line 14 def make_association(attribute, args) #:nodoc: association = @klass.relationships[attribute] if association if association.is_a?(DataMapper::Associations::ManyToOne::Relationship) association.parent_model.make(*args) else association.child_model.make(*args) end else raise_argument_error(attribute) end end |
#make_one_value(attribute, args) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 |
# File 'lib/machinist/data_mapper/lathe.rb', line 5 def make_one_value(attribute, args) #:nodoc: if block_given? raise_argument_error(attribute) unless args.empty? yield else make_association(attribute, args) end end |