From 0bf51e9805260243ec0bbe5fca8f8b9364fdd970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 4 Jan 2012 12:55:11 -0300 Subject: [PATCH] No need to check if YAML::ENGINE is defined since ruby 1.9 does that --- activerecord/lib/active_record/core.rb | 2 +- .../lib/active_support/core_ext/big_decimal/conversions.rb | 2 +- .../lib/active_support/core_ext/string/output_safety.rb | 2 +- activesupport/lib/active_support/ordered_hash.rb | 2 +- activesupport/lib/active_support/time_with_zone.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 980f8fe50f..ee7ff7a2d7 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -319,7 +319,7 @@ def inspect # Hackery to accomodate Syck. Remove for 4.0. def to_yaml(opts = {}) #:nodoc: - if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? + if !YAML::ENGINE.syck? super else coder = {} diff --git a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb index 391bdc925d..403e8beac5 100644 --- a/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +++ b/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb @@ -16,7 +16,7 @@ class BigDecimal # # Note that reconstituting YAML floats to native floats may lose precision. def to_yaml(opts = {}) - return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck? + return super if !YAML::ENGINE.syck? YAML.quick_emit(nil, opts) do |out| string = to_s diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 6cb2ea68b3..4e5675cc8d 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -137,7 +137,7 @@ def encode_with(coder) end def to_yaml(*args) - return super() if defined?(YAML::ENGINE) && !YAML::ENGINE.syck? + return super() if !YAML::ENGINE.syck? to_str.to_yaml(*args) end diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb index d4f309fbd7..fdf4a2bda3 100644 --- a/activesupport/lib/active_support/ordered_hash.rb +++ b/activesupport/lib/active_support/ordered_hash.rb @@ -30,7 +30,7 @@ def encode_with(coder) end def to_yaml(opts = {}) - if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? + if !YAML::ENGINE.syck? return super end diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index d3adf671a0..50fe58a006 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -147,7 +147,7 @@ def encode_with(coder) end def to_yaml(options = {}) - return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck? + return super if !YAML::ENGINE.syck? utc.to_yaml(options) end