Class: Rtasklib::Models::TWDuration

Inherits:
ISO8601::Duration
  • Object
show all
Defined in:
lib/rtasklib/models.rb

Overview

A subclass of the ISO8601::Duration object that use `task calc` to parse string names like 'weekly', 'biannual', and '3 quarters'

Modifies the #initialize method, preserving the original string duration

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (TWDuration) initialize(input, base = nil)

Returns a new instance of TWDuration



21
22
23
24
25
26
# File 'lib/rtasklib/models.rb', line 21

def initialize input, base=nil
  @frozen_value = input.dup.freeze
  parsed = `task calc #{input}`.chomp

  super parsed, base
end

Instance Attribute Details

- (Object) frozen_value (readonly)

Returns the value of attribute frozen_value



19
20
21
# File 'lib/rtasklib/models.rb', line 19

def frozen_value
  @frozen_value
end