summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile4
-rw-r--r--lib/psych/core_ext.rb1
-rw-r--r--lib/psych/scalar_scanner.rb7
-rw-r--r--test/psych/test_engine_manager.rb2
-rw-r--r--test/psych/test_yaml.rb7
5 files changed, 16 insertions, 5 deletions
diff --git a/Rakefile b/Rakefile
index 457327d..87cf8d6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -11,10 +11,10 @@ end
gem 'rake-compiler', '>= 0.4.1'
require "rake/extensiontask"
-Hoe.plugin :debugging, :doofus, :git
+Hoe.plugin :debugging, :doofus, :git, :gemspec
Hoe.spec 'psych' do
- developer 'Aaron Patterson', 'aaronp@rubyforge.org'
+ developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
self.extra_rdoc_files = Dir['*.rdoc']
self.history_file = 'CHANGELOG.rdoc'
diff --git a/lib/psych/core_ext.rb b/lib/psych/core_ext.rb
index be26b2f..2ad75e1 100644
--- a/lib/psych/core_ext.rb
+++ b/lib/psych/core_ext.rb
@@ -36,4 +36,5 @@ module Kernel
end
remove_method :y rescue nil
alias y psych_y
+ private :y
end
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb
index 29d66ee..b92d3c0 100644
--- a/lib/psych/scalar_scanner.rb
+++ b/lib/psych/scalar_scanner.rb
@@ -68,8 +68,11 @@ module Psych
end
i
else
- return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
- return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
+ if string.count('.') < 2
+ return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
+ return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
+ end
+
@string_cache[string] = true
string
end
diff --git a/test/psych/test_engine_manager.rb b/test/psych/test_engine_manager.rb
index d52a80e..b52fd09 100644
--- a/test/psych/test_engine_manager.rb
+++ b/test/psych/test_engine_manager.rb
@@ -21,7 +21,7 @@ module Psych
def test_set_syck
YAML::ENGINE.yamler = 'syck'
- assert_equal Syck, YAML
+ assert_equal ::Syck, YAML
assert_equal 'syck', YAML::ENGINE.yamler
end
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 41bb377..807c058 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -3,6 +3,7 @@
# $Id$
#
require 'psych/helper'
+require 'ostruct'
# [ruby-core:01946]
module Psych_Tests
@@ -14,6 +15,12 @@ class Psych_Unit_Tests < Psych::TestCase
Psych.domain_types.clear
end
+ def test_y_method
+ assert_raises(NoMethodError) do
+ OpenStruct.new.y 1
+ end
+ end
+
def test_syck_compat
time = Time.utc(2010, 10, 10)
yaml = Psych.dump time