Method: Continuity::PeriodicEntry#initialize

Defined in:
lib/continuity/periodic_entry.rb

#initialize(s) ⇒ PeriodicEntry

Returns a new instance of PeriodicEntry.



11
12
13
14
15
16
# File 'lib/continuity/periodic_entry.rb', line 11

def initialize(s)
  matches = s.match(/(\d+)([smhdw])/)
  raise "Unable to parse period: #{s}" if matches.nil?

  @period = matches[1].to_i * PERIODS[matches[2]]
end