Class: Danica::Wrapper::Negative

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from VariablesHolder

#calculate, #variables=

Methods included from Common

#content, #formatted, #gnu, #tex, #to_gnu, #to_tex, #valued?

Methods included from BaseOperations

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

Constructor Details

#initialize(value) ⇒ Negative

Returns a new instance of Negative.



16
17
18
# File 'lib/danica/wrapper/negative.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/negative.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
32
# File 'lib/danica/wrapper/negative.rb', line 28

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

  value == other.value
end

#to(*args) ⇒ Object



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

def to(*args)
  "-#{wrap_as_group(value).to(*args)}"
end

#to_fObject



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

def to_f
  -value.to_f
end