Class: Plurimath::Math::Function::TernaryFunction
- Defined in:
- lib/plurimath/math/function/ternary_function.rb
Direct Known Subclasses
Fenced, Int, Limits, Multiscript, Oint, PowerBase, Prod, Rule, Sum, Underover
Instance Attribute Summary collapse
-
#parameter_one ⇒ Object
Returns the value of attribute parameter_one.
-
#parameter_three ⇒ Object
Returns the value of attribute parameter_three.
-
#parameter_two ⇒ Object
Returns the value of attribute parameter_two.
Instance Method Summary collapse
- #==(object) ⇒ Object
- #any_value_exist? ⇒ Boolean
-
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil) ⇒ TernaryFunction
constructor
A new instance of TernaryFunction.
- #to_asciimath ⇒ Object
- #to_html ⇒ Object
- #to_latex ⇒ Object
- #to_mathml_without_math_tag ⇒ Object
Methods inherited from Core
#class_name, #empty_tag, #extract_class_from_text, #extractable?, #font_style_t_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula
Constructor Details
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil) ⇒ TernaryFunction
Returns a new instance of TernaryFunction.
9 10 11 12 13 14 15 16 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 9 def initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil) @parameter_one = parameter_one @parameter_two = parameter_two @parameter_three = parameter_three Utility.validate_left_right([parameter_one, parameter_two, parameter_three]) end |
Instance Attribute Details
#parameter_one ⇒ Object
Returns the value of attribute parameter_one.
7 8 9 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 7 def parameter_one @parameter_one end |
#parameter_three ⇒ Object
Returns the value of attribute parameter_three.
7 8 9 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 7 def parameter_three @parameter_three end |
#parameter_two ⇒ Object
Returns the value of attribute parameter_two.
7 8 9 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 7 def parameter_two @parameter_two end |
Instance Method Details
#==(object) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 25 def ==(object) self.class == object.class && object.parameter_one == parameter_one && object.parameter_two == parameter_two && object.parameter_three == parameter_three end |
#any_value_exist? ⇒ Boolean
54 55 56 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 54 def any_value_exist? !(parameter_one.nil? || parameter_two.nil? || parameter_three.nil?) end |
#to_asciimath ⇒ Object
18 19 20 21 22 23 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 18 def to_asciimath first_value = first_field_wrap(parameter_one) if parameter_one second_value = "_#{wrapped(parameter_two)}" if parameter_two third_value = "^#{wrapped(parameter_three)}" if parameter_three "#{first_value}#{second_value}#{third_value}" end |
#to_html ⇒ Object
47 48 49 50 51 52 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 47 def to_html first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one second_value = "<i>#{parameter_two.to_html}</i>" if parameter_two third_value = "<i>#{parameter_three.to_html}</i>" if parameter_three "#{first_value}#{second_value}#{third_value}" end |
#to_latex ⇒ Object
40 41 42 43 44 45 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 40 def to_latex first_value = parameter_one&.to_latex second_value = parameter_two&.to_latex third_value = parameter_three&.to_latex "#{first_value}#{second_value}#{third_value}" end |
#to_mathml_without_math_tag ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 32 def to_mathml_without_math_tag value_arr = [parameter_one&.to_mathml_without_math_tag] value_arr << parameter_two&.to_mathml_without_math_tag value_arr << parameter_three&.to_mathml_without_math_tag class_tag = Utility.ox_element("m#{class_name}") Utility.update_nodes(class_tag, value_arr) end |