From 9f5ab945b7118a317a12bd46c73d24575f31ce3f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 23 Nov 2008 15:26:32 -0800 Subject: Lazy-require XmlSimple. Move CGI require to object conversions where it's actually used. --- activesupport/lib/active_support/core_ext/object/conversions.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext/object/conversions.rb') diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb index ad752f0fc5..1dee171ec4 100644 --- a/activesupport/lib/active_support/core_ext/object/conversions.rb +++ b/activesupport/lib/active_support/core_ext/object/conversions.rb @@ -1,3 +1,5 @@ +require 'cgi' + class Object # Alias of to_s. def to_param @@ -11,4 +13,4 @@ class Object def to_query(key) "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}" end -end \ No newline at end of file +end -- cgit v1.2.3 From 27dbc27c4174974a318145d2dc6512457ea37241 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 26 Nov 2008 00:23:00 -0800 Subject: Lazy-require CGI for Object#to_query --- activesupport/lib/active_support/core_ext/object/conversions.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/object/conversions.rb') diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb index 1dee171ec4..278b856c45 100644 --- a/activesupport/lib/active_support/core_ext/object/conversions.rb +++ b/activesupport/lib/active_support/core_ext/object/conversions.rb @@ -1,5 +1,3 @@ -require 'cgi' - class Object # Alias of to_s. def to_param @@ -11,6 +9,7 @@ class Object # # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work. def to_query(key) + require 'cgi' unless defined?(CGI) && defined?(CGI::escape) "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}" end end -- cgit v1.2.3