Class: Plurimath::Math::Function::UnaryFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/plurimath/math/function/unary_function.rb

Direct Known Subclasses

Abs, Arccos, Arcsin, Arctan, Bar, Cancel, Ceil, Cos, Cosh, Cot, Coth, Csc, Csch, Ddot, Deg, Det, Dim, Dot, Exp, F, Floor, G, Gcd, Glb, Hat, Hom, Ker, Lcm, Left, Lg, Liminf, Limsup, Ln, Lub, Max, Min, Norm, Obrace, Sec, Sech, Sin, Sinh, Sqrt, Sup, Tan, Tanh, Td, Text, Tilde, Tr, Ubrace, Ul, Vec

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter_one = nil) ⇒ UnaryFunction

Returns a new instance of UnaryFunction.



9
10
11
# File 'lib/plurimath/math/function/unary_function.rb', line 9

def initialize(parameter_one = nil)
  @parameter_one = parameter_one
end

Instance Attribute Details

#parameter_oneObject

Returns the value of attribute parameter_one.



7
8
9
# File 'lib/plurimath/math/function/unary_function.rb', line 7

def parameter_one
  @parameter_one
end

Instance Method Details

#==(object) ⇒ Object



13
14
15
16
# File 'lib/plurimath/math/function/unary_function.rb', line 13

def ==(object)
  object.class == self.class &&
    object.parameter_one == parameter_one
end

#class_nameObject



35
36
37
# File 'lib/plurimath/math/function/unary_function.rb', line 35

def class_name
  self.class.name.split("::").last.downcase
end

#to_asciimathObject



18
19
20
# File 'lib/plurimath/math/function/unary_function.rb', line 18

def to_asciimath
  "#{class_name}#{value_to_asciimath}"
end

#to_latexObject



30
31
32
33
# File 'lib/plurimath/math/function/unary_function.rb', line 30

def to_latex
  first_value = "{#{parameter_one.to_latex}}" if parameter_one
  "\\#{class_name}#{first_value}"
end

#to_mathml_without_math_tagObject



26
27
28
# File 'lib/plurimath/math/function/unary_function.rb', line 26

def to_mathml_without_math_tag
  "<mi>#{class_name}</mi>"
end

#value_to_asciimathObject



22
23
24
# File 'lib/plurimath/math/function/unary_function.rb', line 22

def value_to_asciimath
  "(#{parameter_one.to_asciimath})" unless parameter_one.nil?
end