Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/to_activerecord.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

def method_missing(meth, *args, &block)
  pattern  = /^to_([a-z][a-z_]*)$/
  if match = pattern.match(meth.to_s)
    if match_class = match[1].camelize.constantize rescue nil
      return match_class.send(:find, *([self] + args), &block)
    end
  end
  super
end