niceogiri 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Niceogiri
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -147,7 +147,10 @@ module Niceogiri
147
147
  # @param [Hash] attrs a hash of attributes to set on the node
148
148
  # @return [self]
149
149
  def inherit_attrs(attrs)
150
- attrs.each { |name, value| self[name] = value }
150
+ attrs.each do |name, value|
151
+ attr_name = value.namespace ? [value.namespace.prefix, name].join(':') : name
152
+ self.write_attr attr_name, value
153
+ end
151
154
  self
152
155
  end
153
156
 
@@ -145,6 +145,12 @@ module Niceogiri
145
145
  n2.to_s.should == n.to_s
146
146
  end
147
147
 
148
+ it 'holds on to namespaces when inheriting attributes' do
149
+ n = Nokogiri::XML.parse('<foo xml:bar="http://bar.com"/>').root
150
+ n2 = Node.new('foo').inherit n
151
+ n2.to_s.should == n.to_s
152
+ end
153
+
148
154
  it 'provides a mechanism to inherit attrs' do
149
155
  n = Node.new 'foo'
150
156
  n2 = Node.new 'foo'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: niceogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-11-02 00:00:00.000000000 Z
13
+ date: 2011-11-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
17
- requirement: &2152693940 !ruby/object:Gem::Requirement
17
+ requirement: &2160319320 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.4.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152693940
25
+ version_requirements: *2160319320
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2152693420 !ruby/object:Gem::Requirement
28
+ requirement: &2160318780 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 2.7.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2152693420
36
+ version_requirements: *2160318780
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &2152692920 !ruby/object:Gem::Requirement
39
+ requirement: &2160318280 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2152692920
47
+ version_requirements: *2160318280
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: yard
50
- requirement: &2152692420 !ruby/object:Gem::Requirement
50
+ requirement: &2160300840 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.6.1
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2152692420
58
+ version_requirements: *2160300840
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &2152692040 !ruby/object:Gem::Requirement
61
+ requirement: &2160300420 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2152692040
69
+ version_requirements: *2160300420
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: guard-rspec
72
- requirement: &2152691520 !ruby/object:Gem::Requirement
72
+ requirement: &2160299940 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2152691520
80
+ version_requirements: *2160299940
81
81
  description: Make dealing with XML less painful
82
82
  email:
83
83
  - ben@langfeld.me
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: 914953420046806191
121
+ hash: 2834614992778249070
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: 914953420046806191
130
+ hash: 2834614992778249070
131
131
  requirements: []
132
132
  rubyforge_project:
133
133
  rubygems_version: 1.8.10