Module: Typedeaf::InstanceMethods
- Defined in:
- lib/typedeaf/instancemethods.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(varname, *args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/typedeaf/instancemethods.rb', line 8 def method_missing(varname, *args) # We only want to peek at the stack if we have no args (i.e. not trying # to make a method call if args.empty? element = __typedeaf_varstack__.last # If our stack is empty then we'll get a nil element back, making sure # we only call into __typedeaf_varstack__ once for the #method_missing # invocation unless element.nil? method_name = element.first # The top of our stack contains something that we want if self.class.__typedeaf_method_parameters__[method_name][varname] return element.last[varname] end end end return super end |