Permalink
Browse files

Lazy-require XmlSimple. Move CGI require to object conversions where …

…it's actually used.
  • Loading branch information...
1 parent e931012 commit 9f5ab945b7118a317a12bd46c73d24575f31ce3f @jeremy jeremy committed Nov 23, 2008
@@ -1,6 +1,4 @@
require 'date'
-require 'cgi'
-require 'xmlsimple'
# Locked down XmlSimple#xml_in_string
class XmlSimple
@@ -168,6 +166,8 @@ def to_xml(options = {})
module ClassMethods
def from_xml(xml)
+ require 'xmlsimple'
+
# TODO: Refactor this into something much cleaner that doesn't rely on XmlSimple
typecast_xml_value(undasherize_keys(XmlSimple.xml_in_string(xml,
'forcearray' => false,
@@ -1,3 +1,5 @@
+require 'cgi'
+
class Object
# Alias of <tt>to_s</tt>.
def to_param
@@ -11,4 +13,4 @@ def to_param
def to_query(key)
"#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
end
-end
+end

0 comments on commit 9f5ab94

Please sign in to comment.