Class: Math::Greeks::Calculator::NilMath
- Inherits:
-
Object
- Object
- Math::Greeks::Calculator::NilMath
- Defined in:
- lib/greeks.rb
Instance Method Summary collapse
- #*(input) ⇒ Object
- #/(input) ⇒ Object
- #divide(input) ⇒ Object
-
#initialize(value) ⇒ NilMath
constructor
A new instance of NilMath.
- #multiply(input) ⇒ Object
- #multiply100 ⇒ Object
- #to_f ⇒ Object
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 |
#multiply100 ⇒ Object
405 406 407 |
# File 'lib/greeks.rb', line 405 def multiply100() multiply(100.0) end |
#to_f ⇒ Object
384 385 386 |
# File 'lib/greeks.rb', line 384 def to_f @value end |