Class: Plurimath::Mathml::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/plurimath/mathml/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Parser

Returns a new instance of Parser.



8
9
10
# File 'lib/plurimath/mathml/parser.rb', line 8

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/plurimath/mathml/parser.rb', line 6

def text
  @text
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
# File 'lib/plurimath/mathml/parser.rb', line 12

def parse
  mml_tree = Mml.parse(
    text,
    version: 4,
    namespace_exist: namespace_exist?,
  )

  Mathml::Translator.new.mml_to_plurimath(mml_tree)
end