Class: String

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



26
27
28
29
30
31
32
33
# File 'lib/to_activerecord.rb', line 26

def method_missing(meth, *args, &block)
  pattern  = /^to_([a-z][a-z_]*)$/
  if match = pattern.match(meth.to_s)
    result = self.to_i.send(meth, *args, &block) rescue nil
    return result if result
  end
  super
end