method
_parse_time
v1_8_7_72 -
Show latest stable
-
0 notes -
Class: Date
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
_parse_time(str, e)
private
Hide source
# File lib/date/format.rb, line 707 def self._parse_time(str, e) # :nodoc: if str.sub!( /( (?: \d+\s*:\s*\d+ (?: \s*:\s*\d+(?:[,.]\d*)? )? | \d+\s*h(?:\s*\d+m?(?:\s*\d+s?)?)? ) (?: \s* [ap](?:m\b|\.m\.) )? | \d+\s*[ap](?:m\b|\.m\.) ) (?: \s* ( (?:gmt|utc?)?[-+]\d+(?:[,.:]\d+(?::\d+)?)? | [[:alpha:].\s]+(?:standard|daylight)\stime\b | [[:alpha:]]+(?:\sdst)?\b ) )? /inx, ' ') t = $1 e.zone = $2 if $2 t =~ /\A(\d+)h? (?:\s*:?\s*(\d+)m? (?: \s*:?\s*(\d+)(?:[,.](\d+))?s? )? )? (?:\s*([ap])(?:m\b|\.m\.))?/inx e.hour = $1.to_i e.min = $2.to_i if $2 e.sec = $3.to_i if $3 e.sec_fraction = Rational($4.to_i, 10**$4.size) if $4 if $5 e.hour %= 12 if $5.downcase == 'p' e.hour += 12 end end true end end