Class: Plurimath::Mathml::Parser
- Inherits:
 - 
      Object
      
        
- Object
 - Plurimath::Mathml::Parser
 
 
- Defined in:
 - lib/plurimath/mathml/parser.rb
 
Instance Attribute Summary collapse
- 
  
    
      #text  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute text.
 
Instance Method Summary collapse
- 
  
    
      #initialize(text)  ⇒ Parser 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Parser.
 - #parse ⇒ Object
 
Constructor Details
#initialize(text) ⇒ Parser
Returns a new instance of Parser.
      11 12 13  | 
    
      # File 'lib/plurimath/mathml/parser.rb', line 11 def initialize(text) @text = text.gsub("\n", "").gsub(" ", "") end  | 
  
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
      9 10 11  | 
    
      # File 'lib/plurimath/mathml/parser.rb', line 9 def text @text end  | 
  
Instance Method Details
#parse ⇒ Object
      15 16 17 18 19 20 21 22  | 
    
      # File 'lib/plurimath/mathml/parser.rb', line 15 def parse tree_t = Plurimath::Mathml::Parse.new.parse(text) formula = Plurimath::Mathml::Transform.new.apply(tree_t) formula = [formula] unless formula.is_a?(Array) || formula.nil? return if formula.nil? Plurimath::Math::Formula.new(formula) end  |