Class: Bagel::Timeframe
- Inherits:
-
Object
- Object
- Bagel::Timeframe
- Defined in:
- lib/bagel/timeframe.rb
Constant Summary collapse
- SECONDS_IN_MINUTE =
60
- SECONDS_IN_HOUR =
3600
Instance Attribute Summary collapse
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #duration ⇒ Object
- #duration_minutes ⇒ Object
-
#initialize(start, finish) ⇒ Timeframe
constructor
A new instance of Timeframe.
Constructor Details
#initialize(start, finish) ⇒ Timeframe
Returns a new instance of Timeframe.
8 9 10 11 |
# File 'lib/bagel/timeframe.rb', line 8 def initialize(start, finish) @start = start @finish = finish end |
Instance Attribute Details
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
3 4 5 |
# File 'lib/bagel/timeframe.rb', line 3 def finish @finish end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
3 4 5 |
# File 'lib/bagel/timeframe.rb', line 3 def start @start end |
Instance Method Details
#duration ⇒ Object
13 14 15 |
# File 'lib/bagel/timeframe.rb', line 13 def duration seconds(finish) - seconds(start) end |
#duration_minutes ⇒ Object
17 18 19 |
# File 'lib/bagel/timeframe.rb', line 17 def duration_minutes duration / SECONDS_IN_MINUTE end |