Skip to content

Commit

Permalink
Cleanup trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Mar 11, 2012
1 parent 9942a01 commit 6731fd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/multi_xml.rb
Expand Up @@ -183,12 +183,12 @@ def typecast_xml_value(value)
when Hash
if value['type'] == 'array'

# this commented-out suggestion helps to avoid the multiple attribute
# this commented-out suggestion helps to avoid the multiple attribute
# problem, but it breaks when there is only one item in the array.
#
#
# from: https://github.com/jnunemaker/httparty/issues/102
#
# _, entries = value.detect { |k, v| k != 'type' && v.is_a?(Array) }
#
# _, entries = value.detect { |k, v| k != 'type' && v.is_a?(Array) }

# This attempt fails to consider the order that the detect method
# retrieves the entries.
Expand All @@ -197,7 +197,7 @@ def typecast_xml_value(value)
# This approach ignores attribute entries that are not convertable
# to an Array which allows attributes to be ignored.
_, entries = value.detect {|k, v| k != 'type' && (v.is_a?(Array) || v.is_a?(Hash)) }

if entries.nil? || (entries.is_a?(String) && entries.strip.empty?)
[]
else
Expand Down
4 changes: 2 additions & 2 deletions lib/multi_xml/parsers/ox.rb
Expand Up @@ -23,7 +23,7 @@ module Parsers
module Ox #:nodoc:

extend self

def parse_error
Exception
end
Expand All @@ -40,7 +40,7 @@ class Handler
def initialize()
@stack = []
end

def doc
@stack[0]
end
Expand Down
4 changes: 2 additions & 2 deletions spec/parser_shared_example.rb
Expand Up @@ -391,7 +391,7 @@
MultiXml.parse(@xml)['users'].should == ["Erik Michaels-Ober", "Wynn Netherland"]
end
end

context "with an attribute type=\"array\" in addition to other attributes" do
before do
@xml = '<users type="array" foo="bar"><user>Erik Michaels-Ober</user><user>Wynn Netherland</user></users>'
Expand All @@ -405,7 +405,7 @@
MultiXml.parse(@xml)['users'].should == ["Erik Michaels-Ober", "Wynn Netherland"]
end
end

context "with an attribute type=\"array\" containing only one item" do
before do
@xml = '<users type="array"><user>Erik Michaels-Ober</user></users>'
Expand Down

0 comments on commit 6731fd4

Please sign in to comment.