Module: MongoMapper::ToDao::ClassMethods

Defined in:
lib/dao/mongo_mapper.rb

Instance Method Summary collapse

Instance Method Details

#to_dao(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dao/mongo_mapper.rb', line 13

def to_dao(*args)

  unless defined?(@to_dao)
    @to_dao = column_names.map{|name| name.to_s}
  end

  unless args.empty?
    @to_dao.clear
    args.flatten.compact.each do |arg|
      @to_dao.push(arg.to_s)
    end
    @to_dao.uniq!
    @to_dao.map!{|name| name.to_s}
  end

  @to_dao
end