Class: Abstractive::TimeSpans

Inherits:
Object
  • Object
show all
Extended by:
Methods
Includes:
Methods
Defined in:
lib/abstractive/timespans.rb

Direct Known Subclasses

Days, Hours, Minutes, Seconds

Defined Under Namespace

Modules: Methods

Constant Summary

Constants included from Methods

Methods::DAY, Methods::HOUR, Methods::MINUTE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Methods

day_decimal, duration, minus_span, notated_time_length, plus_span, time_spans

Constructor Details

#initialize(i) ⇒ TimeSpans

Returns a new instance of TimeSpans.



67
# File 'lib/abstractive/timespans.rb', line 67

def initialize(i); @i = i end

Class Method Details

.at(text, format = STANDARD_FORMAT) ⇒ Object



71
72
73
74
75
# File 'lib/abstractive/timespans.rb', line 71

def at(text, format=STANDARD_FORMAT)
  DateTime.strptime(text, format).to_time
rescue => ex
  Abstractive[:logger].exception(ex,"Trouble turning string into DateTime and then Time object.")
end

Instance Method Details

#to_iObject



68
# File 'lib/abstractive/timespans.rb', line 68

def to_i; @i end