Class: Math::Greeks::Calculator::NilMath

Inherits:
Object
  • Object
show all
Defined in:
lib/greeks.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ NilMath

Returns a new instance of NilMath.



380
381
382
# File 'lib/greeks.rb', line 380

def initialize(value)
  @value = value
end

Instance Method Details

#*(input) ⇒ Object



388
389
390
# File 'lib/greeks.rb', line 388

def *(input)
  multiply(input)
end

#/(input) ⇒ Object



392
393
394
# File 'lib/greeks.rb', line 392

def /(input)
  divide(input)
end

#divide(input) ⇒ Object



409
410
411
412
413
414
415
416
# File 'lib/greeks.rb', line 409

def divide(input)
  if (@value.nil? || input.nil?)
    @value = nil
  else
    @value /= input
  end
  self
end

#multiply(input) ⇒ Object



396
397
398
399
400
401
402
403
# File 'lib/greeks.rb', line 396

def multiply(input)
  if (@value.nil? || input.nil?)
    @value = nil
  else
    @value *= input
  end
  self
end

#multiply100Object



405
406
407
# File 'lib/greeks.rb', line 405

def multiply100()
  multiply(100.0)
end

#to_fObject



384
385
386
# File 'lib/greeks.rb', line 384

def to_f
  @value
end