Class: Mongoid::GridFS::Defaults

Inherits:
Hash
  • Object
show all
Defined in:
lib/mongoid-grid_fs.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/mongoid-grid_fs.rb', line 274

def method_missing(method, *args, &block)
  case method.to_s
    when /(.*)=/
      key = $1
      val = args.first
      update(key => val)
    else
      key = method.to_s
      super unless has_key?(key)
      fetch(key)
  end
end