Class: PatternMatching::MatchExec::ExecuteAs
- Inherits:
-
Object
- Object
- PatternMatching::MatchExec::ExecuteAs
- Defined in:
- lib/patternmatching/pattern.rb
Overview
Private class enabling to use the name of symbols in patterns like a local variables in action blocks
Instance Method Summary collapse
-
#initialize(args, receiver) ⇒ ExecuteAs
constructor
A new instance of ExecuteAs.
- #the ⇒ Object
- #this ⇒ Object
Constructor Details
#initialize(args, receiver) ⇒ ExecuteAs
Returns a new instance of ExecuteAs.
249 250 251 252 253 |
# File 'lib/patternmatching/pattern.rb', line 249 def initialize(args, receiver) @receiver = receiver @wrapper = InstanceVariableAccessor.new receiver @args = args end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
261 262 263 264 |
# File 'lib/patternmatching/pattern.rb', line 261 def method_missing(name, *args) return @args[name] if @args.key?(name) @receiver.send(name, *args) end |
Instance Method Details
#the ⇒ Object
257 258 259 |
# File 'lib/patternmatching/pattern.rb', line 257 def the @wrapper end |
#this ⇒ Object
254 255 256 |
# File 'lib/patternmatching/pattern.rb', line 254 def this @receiver end |