Module: Doing::ChronifyString
- Included in:
- String
- Defined in:
- lib/doing/chronify/string.rb
Overview
Chronify methods for strings
Instance Method Summary collapse
-
#chronify(**options) ⇒ DateTime
Converts input string into a Time object when input takes on the following formats: - interval format e.g.
-
#chronify_qty ⇒ Integer
Converts simple strings into seconds that can be added to a Time object.
-
#expand_date_tags(additional_tags = nil) ⇒ Object
Convert (chronify) natural language dates within configured date tags (tags whose value is expected to be a date).
- #is_range? ⇒ Boolean
-
#split_date_range ⇒ Array<DateTime>
Splits a range string and returns an array of DateTime objects as [start, end].
-
#time_string(format: :dhm) ⇒ Object
Convert DD:HH:MM to a natural language string.
-
#to_seconds ⇒ Integer
Convert DD:HH:MM to seconds.
Instance Method Details
#chronify(**options) ⇒ DateTime
Converts input string into a Time object when input takes on the following formats: - interval format e.g. '1d2h30m', '45m' etc. - a semantic phrase e.g. 'yesterday 5:30pm' - a strftime e.g. '2016-03-15 15:32:04 PDT'
#chronify_qty ⇒ Integer
Converts simple strings into seconds that can be added to a Time object
Input string can be HH:MM or XX[dhm][XXhm][XXm]
#expand_date_tags(additional_tags = nil) ⇒ Object
Convert (chronify) natural language dates within configured date tags (tags whose value is expected to be a date). Modifies string in place.
#is_range? ⇒ Boolean
#split_date_range ⇒ Array<DateTime>
Splits a range string and returns an array of DateTime objects as [start, end]. If only one date is given, end time is nil.
#time_string(format: :dhm) ⇒ Object
Convert DD:HH:MM to a natural language string
#to_seconds ⇒ Integer
Convert DD:HH:MM to seconds