Sha256: 8cca24073af85393bf92573c00314b0e4ccb51891b4ab02a6a09b4f1c3d1c97f
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
require 'time_interval/version' require 'active_support/all' require 'time_interval/duration' require 'time_interval/repeating_interval' require 'time_interval/time_pair' require 'time_interval/time_with_duration' module TimeInterval module_function def interval?(iso8601) iso8601['/'] == '/' end def repeating?(iso8601) !iso8601.match(/^R/).nil? end def duration?(iso8601) iso8601['P'] == 'P' end def parse(iso8601) if interval? iso8601 if repeating?(iso8601) && duration?(iso8601) RepeatingInterval.parse iso8601 elsif duration? iso8601 TimeWithDuration.parse iso8601 else TimePair.parse iso8601 end else TimePair.parse "#{iso8601}/#{iso8601}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
time-interval-0.0.5 | lib/time_interval.rb |