Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb,
lib/pulo/quantity/numeric_overloads.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



197
198
199
200
201
202
203
# File 'lib/pulo/quantity/numeric_overloads.rb', line 197

def *(other)
  if other.is_a?(Pulo::Quantity)
    other*self
  else
    self.old_times(other)
  end
end

#+(other) ⇒ Object



129
130
131
132
133
134
135
# File 'lib/pulo/quantity/numeric_overloads.rb', line 129

def +(other)
  if other.is_a?(Pulo::Dimensionless)
    Pulo::Dimensionless.new(self+other.to_base_unit.value)
  else
    self.old_plus(other)
  end
end

#-(other) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/pulo/quantity/numeric_overloads.rb', line 96

def -(other)
  if other.is_a?(Pulo::Dimensionless)
    Pulo::Dimensionless.new(self-other.to_base_unit.value)
  else
    self.old_minus(other)
  end
end

#/(other) ⇒ Object



163
164
165
166
167
168
169
# File 'lib/pulo/quantity/numeric_overloads.rb', line 163

def /(other)
  if other.is_a?(Pulo::Quantity)
    other.inverse*self
  else
    self.old_div(other)
  end
end

#old_divObject



162
# File 'lib/pulo/quantity/numeric_overloads.rb', line 162

alias :old_div :/

#old_minusObject



95
# File 'lib/pulo/quantity/numeric_overloads.rb', line 95

alias :old_minus :-

#old_plusObject



128
# File 'lib/pulo/quantity/numeric_overloads.rb', line 128

alias :old_plus :+

#old_timesObject



196
# File 'lib/pulo/quantity/numeric_overloads.rb', line 196

alias :old_times :*