Module: Mongoid::DynamicMatchers::ClassMethods

Defined in:
lib/mongoid/dynamic_matchers.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments, &block) ⇒ Object (private)



13
14
15
16
17
18
19
20
21
22
# File 'lib/mongoid/dynamic_matchers.rb', line 13

def method_missing(name, *arguments, &block)
  match = Method.match(self, name)

  if match && match.valid?
    match.define
    send(name, *arguments, &block)
  else
    super
  end
end

Instance Method Details

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

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/mongoid/dynamic_matchers.rb', line 6

def respond_to?(name, include_private = false)
  match = Method.match(self, name)
  match && match.valid? || super
end