Module: Legacy

Defined in:
lib/legacy.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



10
11
12
# File 'lib/legacy.rb', line 10

def method_missing(method_id, *args, &block)
  super(Legacy.real_method(attributes.keys, method_id), *args, &block)
end

Class Method Details

.included(base) ⇒ Object



2
3
4
# File 'lib/legacy.rb', line 2

def self.included(base)
  base.extend ClassMethods
end

.real_method(columns, method) ⇒ Object



6
7
8
# File 'lib/legacy.rb', line 6

def self.real_method(columns, method)
  columns.inject(method.to_s){|m, c| m.gsub(c.downcase, c)}.to_sym
end