Class: AsciiMath::AST::SubSup
- Defined in:
- lib/asciimath/ast.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #==(o) ⇒ Object
- #base_expression ⇒ Object
-
#initialize(e, sub, sup) ⇒ SubSup
constructor
A new instance of SubSup.
- #sub_expression ⇒ Object
- #sup_expression ⇒ Object
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
Instance Method Details
#==(o) ⇒ Object
219 220 221 |
# File 'lib/asciimath/ast.rb', line 219 def ==(o) o.class == self.class && o.base_expression == base_expression && o.sub_expression == sub_expression && o.sup_expression == sup_expression end |
#base_expression ⇒ Object
191 192 193 |
# File 'lib/asciimath/ast.rb', line 191 def base_expression child_nodes[0] end |
#sub_expression ⇒ Object
195 196 197 198 |
# File 'lib/asciimath/ast.rb', line 195 def sub_expression child = child_nodes[1] child.is_a?(Empty) ? nil : child end |
#sup_expression ⇒ Object
200 201 202 203 |
# File 'lib/asciimath/ast.rb', line 200 def sup_expression child = child_nodes[2] child.is_a?(Empty) ? nil : child end |
#to_s ⇒ Object
205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/asciimath/ast.rb', line 205 def to_s s = "" s << base_expression.to_s sub = sub_expression if sub s << "_" << sub.to_s end sup = sup_expression if sup s << "^" << sup.to_s end s end |