Class: AsciiMath::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/asciimath/html.rb,
lib/asciimath/latex.rb,
lib/asciimath/mathml.rb,
lib/asciimath/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asciimath, ast) ⇒ Expression

Returns a new instance of Expression.



810
811
812
813
# File 'lib/asciimath/parser.rb', line 810

def initialize(asciimath, ast)
  @asciimath = asciimath
  @ast = ast
end

Instance Attribute Details

#astObject

Returns the value of attribute ast.



808
809
810
# File 'lib/asciimath/parser.rb', line 808

def ast
  @ast
end

Instance Method Details

#to_html(prefix = "", inline = true, attrs = {}) ⇒ Object



246
247
248
# File 'lib/asciimath/html.rb', line 246

def to_html(prefix = "", inline = true, attrs = {})
  HTMLBuilder.new(:prefix => prefix, :inline => inline).append_expression(ast, attrs).to_s
end

#to_latex(symbol_table = nil) ⇒ Object



403
404
405
# File 'lib/asciimath/latex.rb', line 403

def to_latex(symbol_table = nil)
  LatexBuilder.new(symbol_table).append_expression(ast).to_s
end

#to_mathml(prefix = "", attrs = {}) ⇒ Object



253
254
255
256
257
258
259
# File 'lib/asciimath/mathml.rb', line 253

def to_mathml(prefix = "", attrs = {})
  if prefix.is_a? Hash
    attrs = prefix
    prefix = ""
  end
  MathMLBuilder.new(:prefix => prefix).append_expression(ast, attrs).to_s
end

#to_sObject



815
816
817
# File 'lib/asciimath/parser.rb', line 815

def to_s
  @asciimath
end