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

#initialize(input, base = nil) ⇒ TWDuration

Returns a new instance of TWDuration.



15
16
17
18
19
20
# File 'lib/rtasklib/models.rb', line 15

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

  super parsed, base
end

Instance Attribute Details

#frozen_valueObject (readonly)

Returns the value of attribute frozen_value.



13
14
15
# File 'lib/rtasklib/models.rb', line 13

def frozen_value
  @frozen_value
end