Class: Plurimath::Math::Function::Table
- Defined in:
 - lib/plurimath/math/function/table.rb,
lib/plurimath/math/function/table/align.rb,
lib/plurimath/math/function/table/array.rb,
lib/plurimath/math/function/table/split.rb,
lib/plurimath/math/function/table/matrix.rb,
lib/plurimath/math/function/table/bmatrix.rb,
lib/plurimath/math/function/table/pmatrix.rb,
lib/plurimath/math/function/table/vmatrix.rb,
lib/plurimath/math/function/table/multline.rb 
Defined Under Namespace
Classes: Align, Array, Bmatrix, Matrix, Multline, Pmatrix, Split, Vmatrix
Instance Attribute Summary collapse
- 
  
    
      #close_paren  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute close_paren.
 - 
  
    
      #open_paren  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute open_paren.
 - 
  
    
      #options  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute options.
 - 
  
    
      #value  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute value.
 
Instance Method Summary collapse
- #==(object) ⇒ Object
 - #class_name ⇒ Object
 - 
  
    
      #initialize(value = nil, open_paren = nil, close_paren = nil, options = {})  ⇒ Table 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Table.
 - #to_asciimath ⇒ Object
 - #to_html ⇒ Object
 - #to_latex ⇒ Object
 - #to_mathml_without_math_tag ⇒ Object
 - #to_omml_without_math_tag ⇒ Object
 
Methods inherited from Core
#empty_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #tag_name, #validate_function_formula
Constructor Details
#initialize(value = nil, open_paren = nil, close_paren = nil, options = {}) ⇒ Table
Returns a new instance of Table.
      9 10 11 12 13 14 15 16 17  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 9 def initialize(value = nil, open_paren = nil, close_paren = nil, = {}) @value = value @open_paren = open_paren @close_paren = close_paren @options = end  | 
  
Instance Attribute Details
#close_paren ⇒ Object
Returns the value of attribute close_paren.
      7 8 9  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 7 def close_paren @close_paren end  | 
  
#open_paren ⇒ Object
Returns the value of attribute open_paren.
      7 8 9  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 7 def open_paren @open_paren end  | 
  
#options ⇒ Object
Returns the value of attribute options.
      7 8 9  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 7 def @options end  | 
  
#value ⇒ Object
Returns the value of attribute value.
      7 8 9  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 7 def value @value end  | 
  
Instance Method Details
#==(object) ⇒ Object
      19 20 21 22 23 24 25  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 19 def ==(object) object.class == self.class && object.value == value && object. == && object.open_paren == open_paren && object.close_paren == close_paren end  | 
  
#class_name ⇒ Object
      80 81 82  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 80 def class_name self.class.name.split("::").last.downcase end  | 
  
#to_asciimath ⇒ Object
      27 28 29 30 31 32 33 34  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 27 def to_asciimath parenthesis = Asciimath::Constants::TABLE_PARENTHESIS first_value = value.map(&:to_asciimath).join(", ") third_value = close_paren.is_a?(::Array) || close_paren.nil? lparen = open_paren.nil? ? "[" : open_paren rparen = third_value ? parenthesis[lparen.to_sym] : close_paren "#{lparen}#{first_value}#{rparen}" end  | 
  
#to_html ⇒ Object
      67 68 69 70  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 67 def to_html first_value = value.map(&:to_html).join "<table>#{first_value}</table>" end  | 
  
#to_latex ⇒ Object
      54 55 56 57 58 59 60 61 62 63 64 65  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 54 def to_latex if open_paren == "norm[" return "\\begin{Vmatrix}#{latex_content}\\end{Vmatrix}" end separator = "{#{table_attribute(:latex)}}" if environment&.include?("array") left_paren = latex_parenthesis(open_paren) || "." right_paren = latex_parenthesis(close_paren) || "." left = "\\left #{left_paren}\\begin{matrix}" right = "\\end{matrix}\\right #{right_paren}" "#{left}#{separator}#{latex_content}#{right}" end  | 
  
#to_mathml_without_math_tag ⇒ Object
      36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 36 def to_mathml_without_math_tag table_tag = Utility.ox_element("mtable", attributes: table_attribute) Utility.update_nodes( table_tag, value&.map(&:to_mathml_without_math_tag), ) return norm_table(table_tag) if open_paren == "norm[" if present?(open_paren) || present?(close_paren) first_paren = Utility.ox_element("mo") << mathml_parenthesis(open_paren) second_paren = Utility.ox_element("mo") << mathml_parenthesis(close_paren) mrow_tag = Utility.ox_element("mrow") return Utility.update_nodes(mrow_tag, [first_paren, table_tag, second_paren]) end table_tag end  | 
  
#to_omml_without_math_tag ⇒ Object
      72 73 74 75 76 77 78  | 
    
      # File 'lib/plurimath/math/function/table.rb', line 72 def to_omml_without_math_tag if value.map { |d| d.parameter_one.length == 1 }.all? single_td_table else fenced_table(multiple_td_table) end end  |