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



213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/mongoid/grid_fs.rb', line 213

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