xsd_model 0.5.0 → 0.6.0

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: ab5642b2787d8596e68bbc9ee7389950233d088d
4
- data.tar.gz: 72955be31bdfc6d0ee2e5eab0ca8592fc09e0fd3
3
+ metadata.gz: 804d3f69f695bf3916304c9da3b0d8c443353b0e
4
+ data.tar.gz: e2370ef66bf2977e7dc4be65f01fe5b9010efd5d
5
5
  SHA512:
6
- metadata.gz: 111b7932467ce8a36f7bfc8a1a37c69a582603c3918c56b5c9b0721e8655fe2892acc6d7f66b867245da6b31a6563586508f3a39fde5863da98d132492866592
7
- data.tar.gz: e092dceb6d234cac38f0581c675102821ffabffcc5f71c281fae216ba85361877f773d1e2a51b90801447270afd476edc1e66785b0a665931679961df74024e7
6
+ metadata.gz: 1d0eb4bf82bba8439bfa36f847572a092f9dba3ecf449eeb697a6b28ea5a9dae7ca81dd711172eabdc7fc95062d1c2b7db9a7e2c4dd7291877b17b909e9c702d
7
+ data.tar.gz: 66748ca9aa4cbe7218d5f95ec658495b1fdb5a5bf38889369e7b0df923f0d570804ee5734a1be0db59512311102892ba336e479deef28403f30445aa2bec592a
@@ -20,6 +20,38 @@ module XsdModel
20
20
  @namespaces = hashes[1] || {}
21
21
  end
22
22
 
23
+ def xmlns_prefix
24
+ nil if xmlns_uri.nil?
25
+
26
+ ary = namespaces.to_a
27
+
28
+ candidates = ary.select do |n|
29
+ n[1] == xmlns_uri
30
+ end.map(&:first)
31
+
32
+ full_prefix = candidates.find do |c|
33
+ c.start_with? 'xmlns:'
34
+ end
35
+
36
+ full_prefix&.gsub('xmlns:', '')
37
+ end
38
+
39
+ def xmlns_uri
40
+ namespaces['xmlns']
41
+ end
42
+
43
+ def name_with_prefix
44
+ [xmlns_prefix, name].compact.join(':')
45
+ end
46
+
47
+ def type_with_prefix
48
+ if type&.include? ':'
49
+ type
50
+ else
51
+ [xmlns_prefix, type].compact.join(':')
52
+ end
53
+ end
54
+
23
55
  def xsd_prefix
24
56
  namespaces.invert[XSD_URI].gsub('xmlns:', '')
25
57
  end
@@ -19,6 +19,14 @@ module XsdModel
19
19
  def multiple?
20
20
  max_occurs > 1
21
21
  end
22
+
23
+ def has_ref?
24
+ !ref.nil?
25
+ end
26
+
27
+ def ref
28
+ attributes['ref']
29
+ end
22
30
  end
23
31
  end
24
32
  end
data/xsd_model.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'xsd_model'
7
- spec.version = '0.5.0'
7
+ spec.version = '0.6.0'
8
8
  spec.authors = ['Premysl Donat']
9
9
  spec.email = ['pdonat@seznam.cz']
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsd_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Premysl Donat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri