Class: AsciiMath::AST::Group
- 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) ⇒ Group
constructor
A new instance of Group.
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(lparen, e, rparen) ⇒ Group
Returns a new instance of Group.
163 164 165 166 167 168 |
# File 'lib/asciimath/ast.rb', line 163 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.
160 161 162 |
# File 'lib/asciimath/ast.rb', line 160 def lparen @lparen end |
#rparen ⇒ Object (readonly)
Returns the value of attribute rparen.
161 162 163 |
# File 'lib/asciimath/ast.rb', line 161 def rparen @rparen end |
Instance Method Details
#==(o) ⇒ Object
178 179 180 |
# File 'lib/asciimath/ast.rb', line 178 def ==(o) o.class == self.class && o.lparen == lparen && o.expression == expression && o.rparen == rparen end |
#expression ⇒ Object
170 171 172 |
# File 'lib/asciimath/ast.rb', line 170 def expression child_nodes[0] end |
#to_s ⇒ Object
174 175 176 |
# File 'lib/asciimath/ast.rb', line 174 def to_s "#{lparen.nil? ? '' : lparen.text}#{expression}#{rparen.nil? ? '' : rparen.text}" end |