Class: Danica::Wrapper::PlusMinus

Inherits:
Object
  • Object
show all
Includes:
BaseOperations, VariablesHolder
Defined in:
lib/danica/wrapper/plus_minus.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from VariablesHolder

#calculate, #variables=

Methods included from Common

#content, #formatted, #gnu, #tex, #to, #valued?

Methods included from BaseOperations

#*, #**, #+, #-, #-@, #/

Constructor Details

#initialize(value) ⇒ PlusMinus

Returns a new instance of PlusMinus.



16
17
18
# File 'lib/danica/wrapper/plus_minus.rb', line 16

def initialize(value)
  @value = wrap_value(value)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/danica/wrapper/plus_minus.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
36
# File 'lib/danica/wrapper/plus_minus.rb', line 32

def ==(other)
  return false unless other.class == self.class

  value == other.value
end

#to_fObject



20
21
22
# File 'lib/danica/wrapper/plus_minus.rb', line 20

def to_f
  value.to_f
end

#to_gnu(**options) ⇒ Object



28
29
30
# File 'lib/danica/wrapper/plus_minus.rb', line 28

def to_gnu(**options)
  "+ #{wrap_as_group(value).to_gnu(options)}"
end

#to_tex(**options) ⇒ Object



24
25
26
# File 'lib/danica/wrapper/plus_minus.rb', line 24

def to_tex(**options)
  "\\pm #{wrap_as_group(value).to_tex(options)}"
end