class TimeInterval::TimePair

Attributes

end_time[R]
start_time[R]

Public Class Methods

new(start_time, end_time) click to toggle source
# File lib/time_interval/time_pair.rb, line 16
def initialize(start_time, end_time)
  @start_time = start_time
  @end_time = end_time
end
parse(iso8601) click to toggle source
# File lib/time_interval/time_pair.rb, line 3
def self.parse(iso8601)
  halves = iso8601.split('/')

  fail ArgumentError unless halves.length == 2

  start_time, end_time = halves.map { |time| Time.parse time }

  new start_time, end_time
end

Public Instance Methods

==(other) click to toggle source
# File lib/time_interval/time_pair.rb, line 21
def ==(other)
  return false unless other.is_a? TimePair

  start_time == other.start_time && end_time == other.end_time
end
Also aliased as: eql?
eql?(other)
Alias for: ==
iso8601() click to toggle source
# File lib/time_interval/time_pair.rb, line 29
def iso8601
  "#{start_time.iso8601}/#{end_time.iso8601}"
end