class

ActiveSupport::Duration::ISO8601Parser

rails latest stable - Superclass: Object

Parses a string formatted according to ISO 8601 Duration into the hash.

See ISO 8601 for more information.

This parser allows negative parts to be present in pattern.

Constants

COMMA = ","

DATE_COMPONENT = /(-?\\d+(?:[.,]\\d+)?)(Y|M|D|W)/

DATE_COMPONENTS = [:years, :months, :days]

DATE_MARKER = /P/

DATE_TO_PART = { "Y" => :years, "M" => :months, "W" => :weeks, "D" => :days }

PERIOD = "."

PERIOD_OR_COMMA = /\\.|,/

SIGN_MARKER = /\\A-|\\+|/

TIME_COMPONENT = /(-?\\d+(?:[.,]\\d+)?)(H|M|S)/

TIME_COMPONENTS = [:hours, :minutes, :seconds]

TIME_MARKER = /T/

TIME_TO_PART = { "H" => :hours, "M" => :minutes, "S" => :seconds }

Attributes

[RW]mode
[R]parts
[R]scanner
[RW]sign

Files

  • activesupport/lib/active_support/duration/iso8601_parser.rb