Sha256: c07f31cf4c6cd3e142b2dea07d1eb12e2fee29846c728b735ae49a6a2d7b9afb
Contents?: true
Size: 452 Bytes
Versions: 1
Compression:
Stored size: 452 Bytes
Contents
module TimerCli class Parameters attr_reader :sec def initialize(params) @sec = parse(params[0]) end private def parse(time) if /(?<sec>\d+)(?<variable>[s|m]{1})/ =~ time calculate(sec.to_i, variable) else raise ArgumentError end end def calculate(sec, variable) sec * case variable when 's' 1 when 'm' 60 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timer_cli-0.0.1 | lib/timer_cli/parameters.rb |