Class: Ataulfo::PatternMatching::Body
- Inherits:
-
Object
- Object
- Ataulfo::PatternMatching::Body
- Defined in:
- lib/ataulfo/pattern_matching.rb
Instance Method Summary collapse
-
#initialize(vars, other_self) ⇒ Body
constructor
A new instance of Body.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(vars, other_self) ⇒ Body
Returns a new instance of Body.
7 8 9 10 11 12 |
# File 'lib/ataulfo/pattern_matching.rb', line 7 def initialize(vars, other_self) @other_self = other_self vars.each do |k, v| define_singleton_method(k) { v.value } end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
14 15 16 |
# File 'lib/ataulfo/pattern_matching.rb', line 14 def method_missing(method_name, *args, &block) @other_self.send method_name, *args, &block end |