Class: Ataulfo::PatternMatching::Body

Inherits:
Object
  • Object
show all
Defined in:
lib/ataulfo/pattern_matching.rb

Instance Method Summary collapse

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