method
_xmlschema

v1_9_2_180 -
Show latest stable
-
0 notes -
Class: Date
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (38)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
_xmlschema(str)
public
Hide source
# File lib/date/format.rb, line 1130 def self._xmlschema(str) # :nodoc: if /\A\s*(-?\d{4,})(?:-(\d{2})(?:-(\d{2}))?)? (?:t (\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?)? (z|[-+]\d{2}:\d{2})?\s*\z/x =~ str e = Format::Bag.new e.year = $1.to_i e.mon = $2.to_i if $2 e.mday = $3.to_i if $3 e.hour = $4.to_i if $4 e.min = $5.to_i if $5 e.sec = $6.to_i if $6 e.sec_fraction = Rational($7.to_i, 10**$7.size) if $7 if $8 e.zone = $8 e.offset = zone_to_diff($8) end e.to_hash elsif /\A\s*(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))? (z|[-+]\d{2}:\d{2})?\s*\z/x =~ str e = Format::Bag.new e.hour = $1.to_i if $1 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.zone = $5 e.offset = zone_to_diff($5) end e.to_hash elsif /\A\s*(?:--(\d{2})(?:-(\d{2}))?|---(\d{2})) (z|[-+]\d{2}:\d{2})?\s*\z/x =~ str e = Format::Bag.new e.mon = $1.to_i if $1 e.mday = $2.to_i if $2 e.mday = $3.to_i if $3 if $4 e.zone = $4 e.offset = zone_to_diff($4) end e.to_hash end end