summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/psych/visitors/yaml_tree.rb26
-rw-r--r--test/psych/test_yamldbm.rb1
-rw-r--r--test/psych/visitors/test_to_ruby.rb16
3 files changed, 12 insertions, 31 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb
index 3087a4d..63e14da 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -510,27 +510,11 @@ module Psych
def dump_list o
end
- # '%:z' was no defined until 1.9.3
- if RUBY_VERSION < '1.9.3'
- def format_time time
- formatted = time.strftime("%Y-%m-%d %H:%M:%S.%9N")
-
- if time.utc?
- formatted += " Z"
- else
- zone = time.strftime('%z')
- formatted += " #{zone[0,3]}:#{zone[3,5]}"
- end
-
- formatted
- end
- else
- def format_time time
- if time.utc?
- time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
- else
- time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
- end
+ def format_time time
+ if time.utc?
+ time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
+ else
+ time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
end
end
diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb
index 7853658..62c88b7 100644
--- a/test/psych/test_yamldbm.rb
+++ b/test/psych/test_yamldbm.rb
@@ -77,7 +77,6 @@ module Psych
# end
def test_key
- skip 'only on ruby 2.0.0' if RUBY_VERSION < '2.0.0'
@yamldbm['a'] = 'b'
@yamldbm['c'] = 'd'
assert_equal 'a', @yamldbm.key('b')
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 5c6ba2b..19e5365 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -166,16 +166,14 @@ description:
assert_equal Complex(1,2), mapping.to_ruby
end
- if RUBY_VERSION >= '1.9'
- def test_complex_string
- node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex"
- assert_equal Complex(3, 4), node.to_ruby
- end
+ def test_complex_string
+ node = Nodes::Scalar.new '3+4i', nil, "!ruby/object:Complex"
+ assert_equal Complex(3, 4), node.to_ruby
+ end
- def test_rational_string
- node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational"
- assert_equal Rational(1, 2), node.to_ruby
- end
+ def test_rational_string
+ node = Nodes::Scalar.new '1/2', nil, "!ruby/object:Rational"
+ assert_equal Rational(1, 2), node.to_ruby
end
def test_range_string