Class: Plurimath::Math::Function::TernaryFunction
- Inherits:
-
Object
- Object
- Plurimath::Math::Function::TernaryFunction
- Defined in:
- lib/plurimath/math/function/ternary_function.rb
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
- #class_name ⇒ Object
-
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil) ⇒ TernaryFunction
constructor
A new instance of TernaryFunction.
- #to_asciimath ⇒ Object
- #to_mathml_without_math_tag ⇒ Object
Constructor Details
#initialize(parameter_one = nil, parameter_two = nil, parameter_three = nil) ⇒ TernaryFunction
Returns a new instance of TernaryFunction.
9 10 11 12 13 |
# 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 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
22 23 24 25 26 27 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 22 def ==(object) self.class == object.class && object.parameter_one == parameter_one && object.parameter_two == parameter_two && object.parameter_three == parameter_three end |
#class_name ⇒ Object
36 37 38 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 36 def class_name self.class.name.split("::").last.downcase end |
#to_asciimath ⇒ Object
15 16 17 18 19 20 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 15 def to_asciimath first_value = parameter_one.to_asciimath if parameter_one second_value = "_(#{parameter_two.to_asciimath})" if parameter_two third_value = "^(#{parameter_three.to_asciimath})" if parameter_three "#{first_value}#{second_value}#{third_value}" end |
#to_mathml_without_math_tag ⇒ Object
29 30 31 32 33 34 |
# File 'lib/plurimath/math/function/ternary_function.rb', line 29 def to_mathml_without_math_tag first_value = parameter_one.to_mathml_without_math_tag if parameter_one second_value = parameter_two.to_mathml_without_math_tag if parameter_two third_value = parameter_three.to_mathml_without_math_tag if parameter_three "<m#{class_name}>#{first_value}#{second_value}#{third_value}</m#{class_name}>" end |