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

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

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ NilMath



362
363
364
# File 'lib/greeks.rb', line 362

def initialize(value)
  @value = value
end

Instance Method Details

#*(input) ⇒ Object



370
371
372
# File 'lib/greeks.rb', line 370

def *(input)
  multiply(input)
end

#/(input) ⇒ Object



374
375
376
# File 'lib/greeks.rb', line 374

def /(input)
  divide(input)
end

#divide(input) ⇒ Object



391
392
393
394
395
396
397
398
# File 'lib/greeks.rb', line 391

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

#multiply(input) ⇒ Object



378
379
380
381
382
383
384
385
# File 'lib/greeks.rb', line 378

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

#multiply100Object



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

def multiply100()
  multiply(100.0)
end

#to_fObject



366
367
368
# File 'lib/greeks.rb', line 366

def to_f
  @value
end