pubid-core 1.12.2 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/core/identifier/base.rb +20 -6
- data/lib/pubid/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2905a611f0bd23030009f14b8f3c9cbe7e24efbf3fdb9c2536fb895526a60706
|
4
|
+
data.tar.gz: 12380f2b1a7a2875909ac7c82e78eea20901fbe6c602819dc3054d85d31e754e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d25ff122a185577e2066ac58146f3b0e00059a41137100aafc6c57e412b5706dcf3b0fc1c4d86e53b413edc3933d2e0e50051b91a3d4ec7864e73116cd9316
|
7
|
+
data.tar.gz: 909377bfbd364f597ac87b7bb2e95111c453942e51d533ddb147d040298d59035d7c4fd227e5bc402d1b214e6384358ae1a1760104a96d7d9a0844bba30d24ec
|
@@ -45,7 +45,7 @@ module Pubid::Core
|
|
45
45
|
end
|
46
46
|
|
47
47
|
@publisher = publisher.to_s
|
48
|
-
@number = number
|
48
|
+
@number = number&.to_s
|
49
49
|
@copublisher = copublisher if copublisher
|
50
50
|
@part = part.to_s if part
|
51
51
|
@year = year.to_i if year
|
@@ -61,7 +61,7 @@ module Pubid::Core
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# @return [Hash] Identifier's parameters
|
64
|
-
def to_h(deep: true)
|
64
|
+
def to_h(deep: true, add_type: true)
|
65
65
|
result = instance_variables.map do |var|
|
66
66
|
value = instance_variable_get(var)
|
67
67
|
|
@@ -76,8 +76,8 @@ module Pubid::Core
|
|
76
76
|
]
|
77
77
|
end.to_h
|
78
78
|
|
79
|
-
if respond_to?(:type)
|
80
|
-
result[:type] =
|
79
|
+
if add_type && respond_to?(:type) && type[:short]
|
80
|
+
result[:type] = type[:short]
|
81
81
|
end
|
82
82
|
|
83
83
|
result
|
@@ -92,8 +92,22 @@ module Pubid::Core
|
|
92
92
|
self.class.get_renderer_class.new(to_h(deep: false)).render
|
93
93
|
end
|
94
94
|
|
95
|
-
def exclude(*
|
96
|
-
|
95
|
+
def exclude(*args)
|
96
|
+
nested_exclusions, top_level_exclusions = args.partition { |arg| arg.is_a?(Hash) }
|
97
|
+
|
98
|
+
nested_exclusions = nested_exclusions.reduce({}, :merge)
|
99
|
+
|
100
|
+
excluded_hash = to_h(add_type: false)
|
101
|
+
.reject { |k, v| top_level_exclusions.include?(k) }
|
102
|
+
.each_with_object({}) do |(k, v), memo|
|
103
|
+
memo[k] = if v.is_a?(Hash) && nested_exclusions.key?(k)
|
104
|
+
v.reject { |key, _| nested_exclusions[k].include?(key) }
|
105
|
+
else
|
106
|
+
v
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
self.class.new(**excluded_hash)
|
97
111
|
end
|
98
112
|
|
99
113
|
def typed_stage_abbrev
|
data/lib/pubid/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|