xml_resource 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ module XmlResource
2
2
  class Base
3
3
  TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON'].to_set
4
4
 
5
- class_attribute :attributes, :collections, :objects, :root_path
5
+ class_attribute :attributes, :collections, :objects, :root_path, :remove_namespaces
6
6
  self.attributes = {}
7
7
  self.collections = {}
8
8
  self.objects = {}
@@ -146,7 +146,10 @@ module XmlResource
146
146
  def parse(xml_or_string)
147
147
  case xml_or_string
148
148
  when Nokogiri::XML::Node, Nokogiri::XML::NodeSet then xml_or_string
149
- when String then Nokogiri.XML(xml_or_string).root
149
+ when String
150
+ xml = Nokogiri.XML(xml_or_string)
151
+ xml.remove_namespaces! if remove_namespaces
152
+ xml.root
150
153
  else
151
154
  raise XmlResource::ParseError, "cannot parse #{xml_or_string.inspect}"
152
155
  end
@@ -1,3 +1,3 @@
1
1
  module XmlResource
2
- VERSION = '2.0.0'
3
- end
2
+ VERSION = '2.0.1'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: