Class: AsciiMath::AST::Paren
- Defined in:
- lib/asciimath/ast.rb
Instance Attribute Summary collapse
-
#lparen ⇒ Object
readonly
Returns the value of attribute lparen.
-
#rparen ⇒ Object
readonly
Returns the value of attribute rparen.
Attributes inherited from Node
Instance Method Summary collapse
- #==(o) ⇒ Object
- #expression ⇒ Object
-
#initialize(lparen, e, rparen) ⇒ Paren
constructor
A new instance of Paren.
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(lparen, e, rparen) ⇒ Paren
Returns a new instance of Paren.
139 140 141 142 143 144 |
# File 'lib/asciimath/ast.rb', line 139 def initialize(lparen, e, rparen) super() @lparen = lparen @rparen = rparen add(e) if e end |
Instance Attribute Details
#lparen ⇒ Object (readonly)
Returns the value of attribute lparen.
136 137 138 |
# File 'lib/asciimath/ast.rb', line 136 def lparen @lparen end |
#rparen ⇒ Object (readonly)
Returns the value of attribute rparen.
137 138 139 |
# File 'lib/asciimath/ast.rb', line 137 def rparen @rparen end |
Instance Method Details
#==(o) ⇒ Object
154 155 156 |
# File 'lib/asciimath/ast.rb', line 154 def ==(o) o.class == self.class && o.lparen == lparen && o.expression == expression && o.rparen == rparen end |
#expression ⇒ Object
146 147 148 |
# File 'lib/asciimath/ast.rb', line 146 def expression child_nodes[0] end |
#to_s ⇒ Object
150 151 152 |
# File 'lib/asciimath/ast.rb', line 150 def to_s "#{lparen.nil? ? '' : lparen.text}#{expression}#{rparen.nil? ? '' : rparen.text}" end |