summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/scalar_scanner.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-25 22:12:46 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-25 22:12:46 +0000
commit2695d032e3fe0a342e586a03bd7f0eaffe52c5c1 (patch)
treefccc3320246fcd557ba186723f73a827e837b63d /ext/psych/lib/psych/scalar_scanner.rb
parentba1de001b19ee58a3dc6865dc6acfaa25c6506a1 (diff)
* ext/psych/lib/psych/scalar_scanner.rb: fix parsing timezone's whose
whose format is (+/-)hhmm. Thanks Gonçalo Silva! * test/psych/test_scalar_scanner.rb: test for bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych/scalar_scanner.rb')
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index e1e59d37e3..f7aaea7435 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -90,7 +90,7 @@ module Psych
return time if 'Z' == md[3]
return Time.at(time.to_i, us) unless md[3]
- tz = md[3].split(':').map { |digit| Integer(digit, 10) }
+ tz = md[3].match(/^([+\-]?\d{1,2})\:?(\d{1,2})?$/)[1..-1].compact.map { |digit| Integer(digit, 10) }
offset = tz.first * 3600
if offset < 0