diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-27 23:13:39 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-27 23:13:39 -0800 |
commit | 5cf56a4e7711b952d86d5c9c563bd05d2313883b (patch) | |
tree | 504d641db93b236a7ad82671a0009309d27a8e4b /activesupport/lib/active_support | |
parent | b00cf122e2cb9bb326b2ec5ba4c35c1558362109 (diff) | |
parent | 20cbf8eddc3844126d20f1218f068889d17b0dcf (diff) | |
download | rails-5cf56a4e7711b952d86d5c9c563bd05d2313883b.tar.gz rails-5cf56a4e7711b952d86d5c9c563bd05d2313883b.tar.bz2 rails-5cf56a4e7711b952d86d5c9c563bd05d2313883b.zip |
Merge pull request #3779 from rahul100885/rahul100885_work
Used any? instead of length call
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/jdom.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogiri.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/xml_mini/jdom.rb b/activesupport/lib/active_support/xml_mini/jdom.rb index 6c222b83ba..93a8474c05 100644 --- a/activesupport/lib/active_support/xml_mini/jdom.rb +++ b/activesupport/lib/active_support/xml_mini/jdom.rb @@ -70,7 +70,7 @@ module ActiveSupport hash = get_attributes(element) child_nodes = element.child_nodes - if child_nodes.length > 0 + if child_nodes.any? for i in 0...child_nodes.length child = child_nodes.item(i) merge_element!(hash, child) unless child.node_type == Node.TEXT_NODE diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb index 04ec9e8ab8..fb539e9c88 100644 --- a/activesupport/lib/active_support/xml_mini/nokogiri.rb +++ b/activesupport/lib/active_support/xml_mini/nokogiri.rb @@ -26,7 +26,7 @@ module ActiveSupport else data.ungetc(char) doc = Nokogiri::XML(data) - raise doc.errors.first if doc.errors.length > 0 + raise doc.errors.first if doc.errors.any? doc.to_hash end end |