Class: Fixnum

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

Overview

Fixnum.send(:include, ToActiverecord::Fixnum)

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

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