Module: MAbbre::Interpreter

Defined in:
lib/mabbre/interpreter.rb

Overview

This module is added to the method lookup path and interprets abbreviations for tracked methods.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)

call-seq:

method_missing(name, *args)

If a suitable candidate for abbreviation name is found it will be called using args. Otherwise it will let super handle the missing method.



13
14
15
16
17
18
19
20
21
# File 'lib/mabbre/interpreter.rb', line 13

def method_missing(name, *args)
  matched = nil

  if self.class.tracked_methods(MAbbre).one? {|m| matched = m if m.to_s =~ /\A#{name}/ }
    send(matched, *args)
  else
    super
  end
end