Class: Plurimath::Math::Function::Fenced

Inherits:
TernaryFunction show all
Defined in:
lib/plurimath/math/function/fenced.rb

Instance Attribute Summary

Attributes inherited from TernaryFunction

#parameter_one, #parameter_three, #parameter_two

Instance Method Summary collapse

Methods inherited from TernaryFunction

#==, #class_name, #initialize, #to_html

Constructor Details

This class inherits a constructor from Plurimath::Math::Function::TernaryFunction

Instance Method Details

#to_asciimathObject



9
10
11
12
13
14
# File 'lib/plurimath/math/function/fenced.rb', line 9

def to_asciimath
  first_value  = parameter_one ? parameter_one.to_asciimath : "("
  second_value = parameter_two&.map(&:to_asciimath)&.join(",")
  third_value  = parameter_three ? parameter_three.to_asciimath : ")"
  "#{first_value}#{second_value}#{third_value}"
end

#to_mathml_without_math_tagObject



16
17
18
19
20
21
22
23
# File 'lib/plurimath/math/function/fenced.rb', line 16

def to_mathml_without_math_tag
  first_value  = parameter_one.value
  second_value = parameter_two.map(&:to_mathml_without_math_tag).join
  third_value  = parameter_three.value
  "<mfenced open='#{first_value}' close='#{third_value}'>"\
    "#{second_value}"\
    "</mfenced>"
end