Module: FromHash

Included in:
MongoWrapper, ObjCursor
Defined in:
lib/mongo_persist/util.rb

Instance Method Summary collapse

Instance Method Details

#after_initializeObject



49
50
# File 'lib/mongo_persist/util.rb', line 49

def after_initialize
end

#from_hash(ops) ⇒ Object



39
40
41
42
43
44
# File 'lib/mongo_persist/util.rb', line 39

def from_hash(ops)
  ops.each do |k,v|
    send("#{k}=",v)
  end
  self
end

#initialize(ops = {}) ⇒ Object



45
46
47
48
# File 'lib/mongo_persist/util.rb', line 45

def initialize(ops={})
  from_hash(ops)
  after_initialize
end