Class: Subconv::Utility::Timespan
- Inherits:
-
Object
- Object
- Subconv::Utility::Timespan
- Defined in:
- lib/subconv/utility.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(start_time, end_time) ⇒ Timespan
constructor
A new instance of Timespan.
Constructor Details
#initialize(start_time, end_time) ⇒ Timespan
Returns a new instance of Timespan.
8 9 10 11 12 13 |
# File 'lib/subconv/utility.rb', line 8 def initialize(start_time, end_time) @start_time = start_time @end_time = end_time fail InvalidTimespanError, 'Timespan end time is before start time' if @end_time < @start_time fail InvalidTimespanError, 'Timespan is empty' if @start_time == @end_time end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
19 20 21 |
# File 'lib/subconv/utility.rb', line 19 def end_time @end_time end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
19 20 21 |
# File 'lib/subconv/utility.rb', line 19 def start_time @start_time end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 |
# File 'lib/subconv/utility.rb', line 15 def ==(other) self.class == other.class && @start_time == other.start_time && @end_time == other.end_time end |