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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8abc2d0f36fabb997f6ff163e1670b7cafc87fe
4
- data.tar.gz: daa5e3899254a527f80d0762825b201f77177d96
3
+ metadata.gz: d88463a8e62da995244d3a50be076e097233ab4c
4
+ data.tar.gz: d3076d719c3f7a72341ab4cc34b4467aab740546
5
5
  SHA512:
6
- metadata.gz: 75349d3a759439a1b24b1d4b10042e4bce8536e6cbb97b6383b2663914a6bd0acbf0f414bedd4b15a2b0539fc50fc195e1239dd3e11cf85178d0a1cf05f64f1f
7
- data.tar.gz: 35099fbec920fc5ef8e47f688ee1a92925da789588666006ac0718c006fc153000f8852ecfd08d62573bb75a5da2fcaabd60ab61c1e04f52e0c901c5cfc98c93
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 = ("#{xmlns}:" unless xmlns.blank? ).to_s + (options[:path] || name).to_s
50
-
51
- xpath += "[#{options[:if]}]" if options[:if] and options[:if].is_a? String
52
- xpath += "[not(#{options[:unless]})]" if options[:unless] and options[:unless].is_a? String
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
@@ -1,5 +1,5 @@
1
1
  module Nom
2
2
  module XML
3
- VERSION = '0.5.2'
3
+ VERSION = '0.5.3'
4
4
  end
5
5
  end
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.2
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-02-06 00:00:00.000000000 Z
12
+ date: 2015-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport