Class: Johnson::Nodes::Node
- Inherits:
-
Object
- Object
- Johnson::Nodes::Node
- Defined in:
- lib/johnson/nodes/node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(line, column, value) ⇒ Node
constructor
A new instance of Node.
- #to_dot ⇒ Object
- #to_ecma ⇒ Object (also: #to_js)
- #to_s ⇒ Object (also: #inspect)
- #to_sexp ⇒ Object
Methods included from Visitable
Constructor Details
#initialize(line, column, value) ⇒ Node
Returns a new instance of Node.
35 36 37 38 39 |
# File 'lib/johnson/nodes/node.rb', line 35 def initialize(line, column, value) @line = line @column = column @value = value end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
34 35 36 |
# File 'lib/johnson/nodes/node.rb', line 34 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
34 35 36 |
# File 'lib/johnson/nodes/node.rb', line 34 def line @line end |
#value ⇒ Object
Returns the value of attribute value.
33 34 35 |
# File 'lib/johnson/nodes/node.rb', line 33 def value @value end |
Instance Method Details
#each(&block) ⇒ Object
61 62 63 64 |
# File 'lib/johnson/nodes/node.rb', line 61 def each(&block) EnumeratingVisitor.new(block).accept(self) self end |
#to_dot ⇒ Object
57 58 59 |
# File 'lib/johnson/nodes/node.rb', line 57 def to_dot DotVisitor.new { |d| d.accept(self) } end |
#to_ecma ⇒ Object Also known as: to_js
51 52 53 |
# File 'lib/johnson/nodes/node.rb', line 51 def to_ecma EcmaVisitor.new.accept(self) end |
#to_s ⇒ Object Also known as: inspect
41 42 43 |
# File 'lib/johnson/nodes/node.rb', line 41 def to_s to_sexp.inspect end |
#to_sexp ⇒ Object
47 48 49 |
# File 'lib/johnson/nodes/node.rb', line 47 def to_sexp SexpVisitor.new.accept(self) end |