method
_parse_time
ruby latest stable - Class:
Date
_parse_time(str, e)private
No documentation available.
# File lib/date/format.rb, line 683
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
)
)?
/x,
' ')
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\.))?/x
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