Class: Machinist::MongoMapper::Lathe

Inherits:
Lathe
  • Object
show all
Defined in:
lib/machinist/mongo_mapper/lathe.rb

Instance Method Summary collapse

Instance Method Details

#make_association(attribute, args) ⇒ Object

:nodoc:



14
15
16
17
18
19
20
21
# File 'lib/machinist/mongo_mapper/lathe.rb', line 14

def make_association(attribute, args) #:nodoc:
  association = @klass.associations[attribute]
  if association
    association.klass.make(*args)
  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/mongo_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