Module: MongoModel::DocumentExtensions::DynamicFinders

Included in:
MongoModel::Document
Defined in:
lib/mongomodel/document/dynamic_finders.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



12
13
14
15
16
17
18
# File 'lib/mongomodel/document/dynamic_finders.rb', line 12

def method_missing(method_id, *args, &block)
  if finder = DynamicFinder.match(scoped, method_id)
    finder.execute(*args)
  else
    super
  end
end

Instance Method Details

#respond_to?(method_id, include_private = false) ⇒ Boolean

Returns:



4
5
6
7
8
9
10
# File 'lib/mongomodel/document/dynamic_finders.rb', line 4

def respond_to?(method_id, include_private = false)
  if DynamicFinder.match(scoped, method_id)
    true
  else
    super
  end
end