Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rubiii/nori
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed May 16, 2011
2 parents 3874d74 + e31480b commit 691f6db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/nori/xml_utility_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ def initialize(name, normalized_attributes = {})
# leave the type alone if we don't know what it is
@type = self.class.available_typecasts.include?(attributes["type"]) ? attributes.delete("type") : attributes["type"]

@nil_element = attributes.delete("nil") == "true"
@nil_element = false
attributes.keys.each do |key|
if result = /^((.*):)?nil$/.match(key)
@nil_element = attributes.delete(key) == "true"
attributes.delete("xmlns:#{result[2]}") if result[1]
end
end
@attributes = undasherize_keys(attributes)
@children = []
@text = false
Expand Down
6 changes: 5 additions & 1 deletion spec/nori/nori_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@
<viewed-at type="datetime"></viewed-at>
<content type="yaml"></content>
<parent-id></parent-id>
<nil_true nil="true"/>
<namespaced xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</topic>
EOT

Expand All @@ -256,7 +258,9 @@
'written_on' => nil,
'viewed_at' => nil,
'content' => nil,
'parent_id' => nil
'parent_id' => nil,
'nil_true' => nil,
'namespaced' => nil
}
parse(topic_xml)["topic"].should == expected_topic_hash
end
Expand Down

0 comments on commit 691f6db

Please sign in to comment.