xml-mixup 0.1.16 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2987df3a876da2b544c023d70a16dc8a44eb8bf391af07436263004b180f095
4
- data.tar.gz: d04b0ad24255030ae51d50c7d198d95baf08570ec6a3e411b61119ef329a1542
3
+ metadata.gz: a5088e1b3a412b854e6bc38a37d75b0dc6cc40da1d1d820b70a698b5a933404e
4
+ data.tar.gz: 7f6bc8cb47dd18667d43416b188fda2de98ae30ba11f06e018f2bf0862fb11c4
5
5
  SHA512:
6
- metadata.gz: 6537916b1380983c64e39aaf54048a0a08e6df07662c7319c07df566dee3320dd850b1153cfa705a7f18bacad12a26949d13b968f59c21a76270007889a2a3c2
7
- data.tar.gz: 85d6a953e37ec44ca90f6b28dcb39483de885b094b17fa70caabf9ad18f52d6e723345391c264033df094f82f0db79e892231152615f9e305161badeca80dd8c
6
+ metadata.gz: e701a278fa9043d1a862e5e1a66da14a572836ea7aa423aeaf2810dea387f77820fd9f31349752c2bc4f71d8b359a49bc251a237cc19fc6db972bc763bd4a902
7
+ data.tar.gz: 4c58b9c816020b1f699027ec358802bfcf9dddcdbdf75a30215348edba18678a8ea5041861497b808e3995967c6bc644b953bf73dd1f1a24cc57d07ddd77a2a6
@@ -1,5 +1,5 @@
1
1
  module XML
2
2
  module Mixup
3
- VERSION = "0.1.16"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
data/lib/xml/mixup.rb CHANGED
@@ -70,15 +70,15 @@ module XML::Mixup
70
70
  if ATOMS.any? { |x| obj.is_a? x }
71
71
  obj.to_s
72
72
  elsif obj.is_a? Hash
73
- tmp = obj.sort.map do |kv|
74
- v = flatten_attr kv[1], args
75
- v.nil? ? nil : "#{kv[0].to_s}: #{v}"
73
+ tmp = obj.sort { |a, b| a.first.to_s <=> b.first.to_s }.map do |kv|
74
+ v = flatten_attr kv.last, args
75
+ v.nil? ? nil : "#{kv.first.to_s}: #{v}"
76
76
  end.compact
77
77
  tmp.empty? ? nil : tmp.join(' ')
78
78
  elsif obj.respond_to? :call
79
79
  flatten_attr obj.call(*args), args
80
- elsif obj.respond_to? :map
81
- tmp = obj.map { |x| flatten_attr x, args }.reject do |x|
80
+ elsif [Array, Set].any? { |c| obj.is_a? c }
81
+ tmp = obj.to_a.map { |x| flatten_attr x, args }.reject do |x|
82
82
  x.nil? || x == ''
83
83
  end
84
84
  tmp.empty? ? nil : tmp.join(' ')
@@ -492,6 +492,9 @@ module XML::Mixup
492
492
  extra: [], head: {}, body: {}, attr: {}, content: [],
493
493
  transform: nil, dtd: true, xmlns: true, args: []
494
494
 
495
+ vocab ||= prefix[nil]
496
+ prefix = prefix.except nil if prefix
497
+
495
498
  spec = []
496
499
 
497
500
  # add xslt stylesheet
@@ -573,7 +576,7 @@ module XML::Mixup
573
576
  root[:prefix] = prefix
574
577
 
575
578
  if xmlns
576
- x = prefix.transform_keys { |k| "xmlns:#{k}" }
579
+ x = prefix.except(nil).transform_keys { |k| "xmlns:#{k}" }
577
580
  root = x.merge(root)
578
581
  end
579
582
  end
data/xml-mixup.gemspec CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 2.1"
25
- spec.add_development_dependency "rake", "~> 13.0"
26
- spec.add_development_dependency "rspec", "~> 3.9"
24
+ spec.add_development_dependency "bundler", ">= 2.1"
25
+ spec.add_development_dependency "rake", ">= 13.0"
26
+ spec.add_development_dependency "rspec", ">= 3.9"
27
27
 
28
28
  spec.add_dependency "nokogiri", ">= 1.13.6"
29
29
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-mixup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Taylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-01 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.9'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.9'
55
55
  - !ruby/object:Gem::Dependency
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.3.11
107
+ rubygems_version: 3.4.20
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: A mixin for (XML) markup