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
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 |
#multiply100 ⇒ Object
387 388 389 |
# File 'lib/greeks.rb', line 387 def multiply100() multiply(100.0) end |
#to_f ⇒ Object
366 367 368 |
# File 'lib/greeks.rb', line 366 def to_f @value end |