aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/xml_mini
diff options
context:
space:
mode:
authorNathan Broadbent <nathan.f77@gmail.com>2012-01-30 00:54:17 +0800
committerNathan Broadbent <nathan.f77@gmail.com>2012-01-30 03:15:49 +0800
commitb31eac56097a0bfc5f5af70de91ad261067a395f (patch)
tree940fc90f5132122e70e49cb670776f32af41bde9 /activesupport/lib/active_support/xml_mini
parentec4440fd4e886bc491726070b9fc44938f8798ee (diff)
downloadrails-b31eac56097a0bfc5f5af70de91ad261067a395f.tar.gz
rails-b31eac56097a0bfc5f5af70de91ad261067a395f.tar.bz2
rails-b31eac56097a0bfc5f5af70de91ad261067a395f.zip
Replaced all 'for' loops with Enumerable#each
Diffstat (limited to 'activesupport/lib/active_support/xml_mini')
-rw-r--r--activesupport/lib/active_support/xml_mini/jdom.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/xml_mini/jdom.rb b/activesupport/lib/active_support/xml_mini/jdom.rb
index 6c222b83ba..dbb6c71907 100644
--- a/activesupport/lib/active_support/xml_mini/jdom.rb
+++ b/activesupport/lib/active_support/xml_mini/jdom.rb
@@ -71,7 +71,7 @@ module ActiveSupport
child_nodes = element.child_nodes
if child_nodes.length > 0
- for i in 0...child_nodes.length
+ (0...child_nodes.length).each do |i|
child = child_nodes.item(i)
merge_element!(hash, child) unless child.node_type == Node.TEXT_NODE
end
@@ -133,7 +133,7 @@ module ActiveSupport
def get_attributes(element)
attribute_hash = {}
attributes = element.attributes
- for i in 0...attributes.length
+ (0...attributes.length).each do |i|
attribute_hash[CONTENT_KEY] ||= ''
attribute_hash[attributes.item(i).name] = attributes.item(i).value
end
@@ -147,7 +147,7 @@ module ActiveSupport
def texts(element)
texts = []
child_nodes = element.child_nodes
- for i in 0...child_nodes.length
+ (0...child_nodes.length).each do |i|
item = child_nodes.item(i)
if item.node_type == Node.TEXT_NODE
texts << item.get_data
@@ -163,7 +163,7 @@ module ActiveSupport
def empty_content?(element)
text = ''
child_nodes = element.child_nodes
- for i in 0...child_nodes.length
+ (0...child_nodes.length).each do |i|
item = child_nodes.item(i)
if item.node_type == Node.TEXT_NODE
text << item.get_data.strip