Class: Subconv::Utility::Timespan

Inherits:
Object
  • Object
show all
Defined in:
lib/subconv/utility.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timeObject (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_timeObject (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