aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/xml_mini/nokogiri.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/xml_mini/nokogiri.rb')
-rw-r--r--activesupport/lib/active_support/xml_mini/nokogiri.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb
index 619cc7522d..b92fa7ea7c 100644
--- a/activesupport/lib/active_support/xml_mini/nokogiri.rb
+++ b/activesupport/lib/active_support/xml_mini/nokogiri.rb
@@ -1,11 +1,11 @@
begin
- require 'nokogiri'
+ require "nokogiri"
rescue LoadError => e
$stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
raise e
end
-require 'active_support/core_ext/object/blank'
-require 'stringio'
+require "active_support/core_ext/object/blank"
+require "stringio"
module ActiveSupport
module XmlMini_Nokogiri #:nodoc:
@@ -16,7 +16,7 @@ module ActiveSupport
# XML Document string or IO to parse
def parse(data)
if !data.respond_to?(:read)
- data = StringIO.new(data || '')
+ data = StringIO.new(data || "")
end
char = data.getc
@@ -38,7 +38,7 @@ module ActiveSupport
end
module Node #:nodoc:
- CONTENT_ROOT = '__content__'.freeze
+ CONTENT_ROOT = "__content__".freeze
# Convert XML document to hash.
#
@@ -49,9 +49,9 @@ module ActiveSupport
# Insert node hash into parent hash correctly.
case hash[name]
- when Array then hash[name] << node_hash
- when Hash then hash[name] = [hash[name], node_hash]
- when nil then hash[name] = node_hash
+ when Array then hash[name] << node_hash
+ when Hash then hash[name] = [hash[name], node_hash]
+ when nil then hash[name] = node_hash
end
# Handle child elements
@@ -59,7 +59,7 @@ module ActiveSupport
if c.element?
c.to_hash(node_hash)
elsif c.text? || c.cdata?
- node_hash[CONTENT_ROOT] ||= ''
+ node_hash[CONTENT_ROOT] ||= ""
node_hash[CONTENT_ROOT] << c.content
end
end