Class: DoubleOrNothing::Calculator
- Inherits:
-
Object
- Object
- DoubleOrNothing::Calculator
- Defined in:
- lib/double_or_nothing/calculator.rb
Instance Method Summary collapse
- #call ⇒ Object
- #difference ⇒ Object
-
#initialize(person_one, person_two) ⇒ Calculator
constructor
A new instance of Calculator.
Constructor Details
#initialize(person_one, person_two) ⇒ Calculator
Returns a new instance of Calculator.
3 4 5 |
# File 'lib/double_or_nothing/calculator.rb', line 3 def initialize(person_one, person_two) @elder, @younger = [person_one.birthday, person_two.birthday].sort end |
Instance Method Details
#call ⇒ Object
11 12 13 |
# File 'lib/double_or_nothing/calculator.rb', line 11 def call younger + difference end |
#difference ⇒ Object
7 8 9 |
# File 'lib/double_or_nothing/calculator.rb', line 7 def difference younger - elder end |