module MAbbre::Interpreter
This module is added to the method lookup path and interprets abbreviations for tracked methods.
Private Instance Methods
method_missing(name, *args)
click to toggle source
If a suitable candidate for abbreviation name
is found it will be called using args
. Otherwise it will let super
handle the missing method.
Calls superclass method
# 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 =~ /\A#{name}/ } send(matched, *args) else super end end
respond_to_missing?(name, include_all) → true or false
click to toggle source
Checks if this object responds to abbreviation name
. The include_all
parameter is not used but it will be passed to super
if no suitable candidate is found.
Returns true
if this object responds to name
, or whatever super
returns otherwise.
Calls superclass method
# File lib/mabbre/interpreter.rb, line 31 def respond_to_missing?(name, include_all) self.class.tracked_methods(MAbbre).one? {|m| m =~ /\A#{name}/ } or super end