Class: AsciiMath::AST::Matrix
- 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
-
#initialize(lparen, rows, rparen) ⇒ Matrix
constructor
A new instance of Matrix.
- #to_s ⇒ Object
Methods inherited from InnerNode
Constructor Details
#initialize(lparen, rows, rparen) ⇒ Matrix
Returns a new instance of Matrix.
405 406 407 408 409 410 |
# File 'lib/asciimath/ast.rb', line 405 def initialize(lparen, rows, rparen) super() @lparen = lparen @rparen = rparen rows.map { |row| MatrixRow.new(row) }.each { |row_seq| add(row_seq) } end |
Instance Attribute Details
#lparen ⇒ Object (readonly)
Returns the value of attribute lparen.
402 403 404 |
# File 'lib/asciimath/ast.rb', line 402 def lparen @lparen end |
#rparen ⇒ Object (readonly)
Returns the value of attribute rparen.
403 404 405 |
# File 'lib/asciimath/ast.rb', line 403 def rparen @rparen end |
Instance Method Details
#==(o) ⇒ Object
419 420 421 422 423 424 |
# File 'lib/asciimath/ast.rb', line 419 def ==(o) o.class == self.class && o.lparen == lparen && o.child_nodes == child_nodes && o.rparen == rparen end |
#to_s ⇒ Object
412 413 414 415 416 417 |
# File 'lib/asciimath/ast.rb', line 412 def to_s s = "" s << (lparen.nil? ? '{:' : lparen.text) s << child_nodes.map { |node| node.to_s }.join(",") s << (rparen.nil? ? ':}' : rparen.text) end |