Class: PseudoBinding
- Inherits:
-
Object
- Object
- PseudoBinding
- Defined in:
- lib/parsely.rb
Defined Under Namespace
Classes: PerlVar
Constant Summary collapse
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#vals ⇒ Object
readonly
Returns the value of attribute vals.
Instance Method Summary collapse
-
#initialize(lineno, vals) ⇒ PseudoBinding
constructor
A new instance of PseudoBinding.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(lineno, vals) ⇒ PseudoBinding
Returns a new instance of PseudoBinding.
57 58 59 |
# File 'lib/parsely.rb', line 57 def initialize lineno, vals @line, @vals = PerlVar.new(lineno.to_s), vals.map {|x| PerlVar.new(x)} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/parsely.rb', line 60 def method_missing name, *args if args.empty? if name =~ /_(\d+)/ @vals[$1.to_i] || PerlNil else name.to_s end else super end end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
55 56 57 |
# File 'lib/parsely.rb', line 55 def line @line end |
#vals ⇒ Object (readonly)
Returns the value of attribute vals.
56 57 58 |
# File 'lib/parsely.rb', line 56 def vals @vals end |