xml-mixup 0.1.16 → 0.2.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
  SHA256:
3
- metadata.gz: f2987df3a876da2b544c023d70a16dc8a44eb8bf391af07436263004b180f095
4
- data.tar.gz: d04b0ad24255030ae51d50c7d198d95baf08570ec6a3e411b61119ef329a1542
3
+ metadata.gz: 460b4560533df750db75bcee4c5a6eedfaaece84faea406fc3f2711845ab17c0
4
+ data.tar.gz: 1f6311bcaa48547ce09f3ee718afa0077589addd2466982aaee2dd743035d6fa
5
5
  SHA512:
6
- metadata.gz: 6537916b1380983c64e39aaf54048a0a08e6df07662c7319c07df566dee3320dd850b1153cfa705a7f18bacad12a26949d13b968f59c21a76270007889a2a3c2
7
- data.tar.gz: 85d6a953e37ec44ca90f6b28dcb39483de885b094b17fa70caabf9ad18f52d6e723345391c264033df094f82f0db79e892231152615f9e305161badeca80dd8c
6
+ metadata.gz: 2de6209eba128209f7433fcb50df44f9f4de64e3607e82d81e24b4b64c76a3c4e7d88d5625d4e3db2f9c2022058ca2fba6dd99764ccabd1bc7cecaf20c15696a
7
+ data.tar.gz: 163e037051e2f295254d3aa11972f213faf904e458aa8276e2451cfe4653defe69f617d6e322d3b7a1eeff952b1ccd2b4d4434360040b0c1d7949b4a92807463
@@ -1,5 +1,5 @@
1
1
  module XML
2
2
  module Mixup
3
- VERSION = "0.1.16"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/xml/mixup.rb CHANGED
@@ -71,14 +71,14 @@ module XML::Mixup
71
71
  obj.to_s
72
72
  elsif obj.is_a? Hash
73
73
  tmp = obj.sort.map do |kv|
74
- v = flatten_attr kv[1], args
75
- v.nil? ? nil : "#{kv[0].to_s}: #{v}"
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.0
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: 2023-11-22 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.3.15
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: A mixin for (XML) markup