nom-xml 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nom/xml/term.rb +12 -6
- data/lib/nom/xml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d88463a8e62da995244d3a50be076e097233ab4c
|
4
|
+
data.tar.gz: d3076d719c3f7a72341ab4cc34b4467aab740546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8ef27ba54a67f388fe84adc08bb2b6ab4ae35935c1036aeb1acab76534b5d5be107ad6e53d123fd25d436e4357dc1175000d1d5329d1f22d5beb1f8f756957
|
7
|
+
data.tar.gz: f5c49bc0577b7dbefd2479dae23de625a872762a3d993b2d38fe3217c6f0caa858e3da6aa1a07bbffc253ee85cfd7f3ef3c416f3e053106c75b3c2ae1cb6e952
|
data/lib/nom/xml/term.rb
CHANGED
@@ -6,6 +6,8 @@ module Nom::XML
|
|
6
6
|
attr_writer :parent
|
7
7
|
attr_reader :options
|
8
8
|
|
9
|
+
PATH_SEPARATOR = '/'
|
10
|
+
|
9
11
|
##
|
10
12
|
# Create a new Nom::XML::Term
|
11
13
|
#
|
@@ -25,7 +27,7 @@ module Nom::XML
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def full_name
|
28
|
-
[parent.full_name, "term:#{name}"].join(
|
30
|
+
@full_name ||= [parent.full_name, "term:#{name}"].join(PATH_SEPARATOR)
|
29
31
|
end
|
30
32
|
|
31
33
|
##
|
@@ -39,17 +41,21 @@ module Nom::XML
|
|
39
41
|
# Get the absolute xpath to this node
|
40
42
|
# @return [String]
|
41
43
|
def xpath
|
42
|
-
[parent_xpath, local_xpath].flatten.compact.join(
|
44
|
+
@xpath ||= [parent_xpath, local_xpath].flatten.compact.join(PATH_SEPARATOR)
|
43
45
|
end
|
44
46
|
|
45
47
|
##
|
46
48
|
# Get the relative xpath to this node from its immediate parent's term
|
47
49
|
# @return [String]
|
48
50
|
def local_xpath
|
49
|
-
xpath =
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
xpath = if xmlns.blank?
|
52
|
+
""
|
53
|
+
else
|
54
|
+
xmlns + ":"
|
55
|
+
end
|
56
|
+
xpath << "#{options[:path] || name}"
|
57
|
+
xpath << "[#{options[:if]}]" if options[:if] and options[:if].is_a? String
|
58
|
+
xpath << "[not(#{options[:unless]})]" if options[:unless] and options[:unless].is_a? String
|
53
59
|
|
54
60
|
xpath
|
55
61
|
end
|
data/lib/nom/xml/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nom-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|