activedocument 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ActiveDocument/active_document.rb +12 -10
- metadata +2 -2
@@ -121,7 +121,7 @@ module ActiveDocument
|
|
121
121
|
def method_missing(method_id, * arguments, & block)
|
122
122
|
@@log.debug("ActiveDocument::Base at line #{__LINE__}: method called is #{method_id} with arguments #{arguments}")
|
123
123
|
method = method_id.to_s
|
124
|
-
method = method.sub("HYPHEN","-")
|
124
|
+
method = method.sub("HYPHEN", "-")
|
125
125
|
if method =~ /^(\w*-?\w*)$/ # methods with no '.' in them and not ending in '='
|
126
126
|
if arguments.length > 0
|
127
127
|
super
|
@@ -288,11 +288,13 @@ module ActiveDocument
|
|
288
288
|
def initialize(nodeset, parent)
|
289
289
|
@document = nodeset
|
290
290
|
@root =
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
291
|
+
if nodeset.instance_of? Nokogiri::XML::Element then
|
292
|
+
nodeset.name
|
293
|
+
elsif nodeset.instance_of? Nokogiri::XML::NodeSet
|
294
|
+
nodeset.first.name
|
295
|
+
else
|
296
|
+
nodeset[0].name
|
297
|
+
end
|
296
298
|
@my_namespaces = parent.class.my_namespaces
|
297
299
|
@my_default_namespace = parent.class.my_default_namespace
|
298
300
|
end
|
@@ -369,10 +371,10 @@ module ActiveDocument
|
|
369
371
|
def set_attribute(attribute, value)
|
370
372
|
namespace = namespace_for_element(attribute)
|
371
373
|
node = if namespace.nil? || namespace.empty?
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
374
|
+
@document.xpath("@#{attribute}")
|
375
|
+
else
|
376
|
+
@document.xpath("@ns:#{attribute}", {'ns' => namespace})
|
377
|
+
end
|
376
378
|
node[0].child.content = value
|
377
379
|
|
378
380
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: activedocument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Clark D. Richey, Jr.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|