# class Puppet::Settings::DurationSetting

A setting that represents a span of time, and evaluates to an integer number of seconds after being parsed

### Constants

FORMAT

  A regex describing valid formats with groups for capturing the value and units

UNITMAP

  How we convert from various units to seconds.

### Public Instance Methods

munge(value) click to toggle source

Convert the value to an integer, parsing numeric string with units if necessary.

    # File lib/puppet/settings/duration_setting.rb, line 24
    def munge(value)
      case
      when value.is_a?(Integer)
        value
      when (value.is_a?(String) and value =~ FORMAT)
        $1.to_i * UNITMAP[$2 || 's']
      else
        raise Puppet::Settings::ValidationError, "Invalid duration format '#{value.inspect}' for parameter: #{@name}"
      end
    end

type() click to toggle source

    # File lib/puppet/settings/duration_setting.rb, line 19
    def type
      :duration
    end