class Slop::DurationOption
Custom duration type for Slop
, used for –expires. Raises aggressively because this is a tricky and lightly documented option.
Constants
- UNITS
Public Instance Methods
call(value)
click to toggle source
# File lib/httpdisk/slop_duration.rb, line 16 def call(value) m = value.match(/^(\d+)([smhdwy])?$/) raise Slop::Error, "invalid --expires #{value.inspect}" if !m num, unit = m[1].to_i, (m[2] || 's').to_sym num * UNITS[unit] end