Class: Plurimath::Math::Function::BinaryFunction
  
  
  
  
  
    - Inherits:
 
    - 
      Object
      
        
          - Object
 
          
            - Plurimath::Math::Function::BinaryFunction
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/plurimath/math/function/binary_function.rb
 
  
  
 
  Direct Known Subclasses
  Base, Color, FontStyle, Frac, Inf, Int, Lim, Log, Mod, Oint, Overset, Power, Prod, Root, Stackrel, Substack, Sum, Underset
 
  Instance Attribute Summary collapse
  
  
    
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    #initialize(parameter_one = nil, parameter_two = nil)  ⇒ BinaryFunction 
  
  
  
  
    
Returns a new instance of BinaryFunction.
   
 
  
  
    
      
9
10
11
12 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 9
def initialize(parameter_one = nil, parameter_two = nil)
  @parameter_one = parameter_one
  @parameter_two = parameter_two
end 
     | 
  
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #parameter_one  ⇒ Object 
  
  
  
  
    
Returns the value of attribute parameter_one.
   
 
  
  
    
      
7
8
9 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 7
def parameter_one
  @parameter_one
end 
     | 
  
 
    
      
      
      
  
  
    #parameter_two  ⇒ Object 
  
  
  
  
    
Returns the value of attribute parameter_two.
   
 
  
  
    
      
7
8
9 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 7
def parameter_two
  @parameter_two
end 
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #==(object)  ⇒ Object 
  
  
  
  
    
      
24
25
26
27
28 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 24
def ==(object)
  object.class == self.class &&
    object.parameter_one == parameter_one &&
    object.parameter_two == parameter_two
end
     | 
  
 
    
      
  
  
    #class_name  ⇒ Object 
  
  
  
  
    
      
47
48
49 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 47
def class_name
  self.class.name.split("::").last.downcase
end
     | 
  
 
    
      
  
  
    #invert_unicode_symbols  ⇒ Object 
  
  
  
  
    
      
37
38
39 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 37
def invert_unicode_symbols
  Mathml::Constants::UNICODE_SYMBOLS.invert[class_name].to_s
end 
     | 
  
 
    
      
  
  
    #to_asciimath  ⇒ Object 
  
  
  
  
    
      
14
15
16 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 14
def to_asciimath
  "#{class_name}#{value_to_asciimath}"
end
     | 
  
 
    
      
  
  
    #to_latex  ⇒ Object 
  
  
  
  
    
      
41
42
43
44
45 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 41
def to_latex
  first_value = "{#{parameter_one.to_latex}}" if parameter_one
  second_value = "{#{parameter_two.to_latex}}" if parameter_two
  "\\#{class_name}#{first_value}#{second_value}"
end
     | 
  
 
    
      
  
  
    #to_mathml_without_math_tag  ⇒ Object 
  
  
  
  
    
      
30
31
32
33
34
35 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 30
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 = invert_unicode_symbols.empty? ? class_name : invert_unicode_symbols
  "<mo>#{third_value}</mo>#{first_value}#{second_value}"
end
     | 
  
 
    
      
  
  
    #value_to_asciimath  ⇒ Object 
  
  
  
  
    
      
18
19
20
21
22 
     | 
    
      # File 'lib/plurimath/math/function/binary_function.rb', line 18
def value_to_asciimath
  first_value = "(#{parameter_one.to_asciimath})" if parameter_one
  second_value = "(#{parameter_two.to_asciimath})" if parameter_two
  "#{first_value}#{second_value}"
end
     |