summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--lib/psych/scalar_scanner.rb5
-rw-r--r--lib/psych/versions.rb2
-rw-r--r--psych.gemspec2
-rw-r--r--test/psych/test_scalar_scanner.rb6
5 files changed, 12 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml
index 6349ed9..ab08cd5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,11 +3,11 @@ rvm:
- 2.3.3
- 2.4.0
- ruby-head
- - jruby-9.1.7.0
+ - jruby-9.1.8.0
matrix:
allow_failures:
- - rvm: jruby-9.1.7.0
+ - rvm: jruby-9.1.8.0
before_script:
- unset JRUBY_OPTS
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb
index a849359..449efa4 100644
--- a/lib/psych/scalar_scanner.rb
+++ b/lib/psych/scalar_scanner.rb
@@ -10,7 +10,6 @@ module Psych
# Taken from http://yaml.org/type/float.html
FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10)
- |[-+]?[0-9][0-9_,]*(:[0-5]?[0-9])+\.[0-9_]*(?# base 60)
|[-+]?\.(inf|Inf|INF)(?# infinity)
|\.(nan|NaN|NAN)(?# not a number))$/x
@@ -83,13 +82,13 @@ module Psych
else
@symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
end
- when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+$/
+ when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_i * 60 ** (e - 2).abs)
end
i
- when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+\.[0-9_]*$/
+ when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}\.[0-9_]*$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_f * 60 ** (e - 2).abs)
diff --git a/lib/psych/versions.rb b/lib/psych/versions.rb
index b602765..12029f0 100644
--- a/lib/psych/versions.rb
+++ b/lib/psych/versions.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Psych
# The version is Psych you're using
- VERSION = '2.2.4'
+ VERSION = '3.0.0.beta1'
if RUBY_ENGINE == 'jruby'
DEFAULT_SNAKEYAML_VERSION = '1.18'.freeze
diff --git a/psych.gemspec b/psych.gemspec
index d705952..53a28fe 100644
--- a/psych.gemspec
+++ b/psych.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "psych"
- s.version = "2.2.4"
+ s.version = "3.0.0.beta1"
s.authors = ["Aaron Patterson", "SHIBATA Hiroshi", "Charles Oliver Nutter"]
s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org", "headius@headius.com"]
s.date = "2016-11-14"
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 9b6d8c1..e51fc69 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -88,6 +88,12 @@ module Psych
assert_equal :foo, ss.tokenize(':foo')
end
+ def test_scan_not_sexagesimal
+ assert_equal '00:00:00:00:0f', ss.tokenize('00:00:00:00:0f')
+ assert_equal '00:00:00:00:00', ss.tokenize('00:00:00:00:00')
+ assert_equal '00:00:00:00:00.0', ss.tokenize('00:00:00:00:00.0')
+ end
+
def test_scan_sexagesimal_float
assert_equal 685230.15, ss.tokenize('190:20:30.15')
end