pubid-core 1.12.0 → 1.12.1
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 +9 -5
- data/lib/pubid/core/identifier.rb +2 -2
- 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: 448ee8d0c3ee2f141390d279b470709a69d479dd8203aab75202ec53f4b5d219
|
4
|
+
data.tar.gz: '0284a013694e73ddba1e96d3c560dbd27f15a69840f50cc33f19035adab3a373'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c8e1f74a0fb9fedb9388971edf1f2920917b1ea2d9d1fedab7cd7168412a9c085434f3da4ddf796d1921909db6589af4e1b4430a795227df65cf0dd2dc136b
|
7
|
+
data.tar.gz: 8c53cb46cf3fed1bcfbf1138063fbc728ad9c80b03b903a46acd211ce79fce6a086530280fbe6a63ef0d08671d468d6e9eaba489e9e22bfc0709f10da54fd776
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Pubid::Core
|
2
2
|
module Identifier
|
3
3
|
class Base
|
4
|
-
attr_accessor :number, :publisher, :copublisher, :part,
|
5
|
-
:type, :year, :edition, :language, :amendments,
|
4
|
+
attr_accessor :number, :publisher, :copublisher, :part, :year, :edition, :language, :amendments,
|
6
5
|
:corrigendums, :stage
|
7
6
|
|
8
7
|
TYPED_STAGES = {}.freeze
|
@@ -21,7 +20,7 @@ module Pubid::Core
|
|
21
20
|
# @param corrigendums [Array<Corrigendum>,Array<Hash>] document's corrigendums
|
22
21
|
# @see Amendment
|
23
22
|
# @see Corrigendum
|
24
|
-
def initialize(publisher:, number:, copublisher: nil, part: nil,
|
23
|
+
def initialize(publisher:, number:, copublisher: nil, part: nil,
|
25
24
|
year: nil, edition: nil, language: nil, amendments: nil,
|
26
25
|
corrigendums: nil, stage: nil)
|
27
26
|
|
@@ -49,7 +48,6 @@ module Pubid::Core
|
|
49
48
|
@number = number
|
50
49
|
@copublisher = copublisher if copublisher
|
51
50
|
@part = part.to_s if part
|
52
|
-
@type = type.to_s if type
|
53
51
|
@year = year.to_i if year
|
54
52
|
@edition = edition.to_i if edition
|
55
53
|
@language = language.to_s if language
|
@@ -64,7 +62,7 @@ module Pubid::Core
|
|
64
62
|
|
65
63
|
# @return [Hash] Identifier's parameters
|
66
64
|
def to_h(deep: true)
|
67
|
-
instance_variables.map do |var|
|
65
|
+
result = instance_variables.map do |var|
|
68
66
|
value = instance_variable_get(var)
|
69
67
|
|
70
68
|
[var.to_s.gsub("@", "").to_sym,
|
@@ -77,6 +75,12 @@ module Pubid::Core
|
|
77
75
|
end
|
78
76
|
]
|
79
77
|
end.to_h
|
78
|
+
|
79
|
+
if respond_to?(:type)
|
80
|
+
result[:type] = self.type[:key]
|
81
|
+
end
|
82
|
+
|
83
|
+
result
|
80
84
|
end
|
81
85
|
|
82
86
|
def ==(other)
|
@@ -12,10 +12,10 @@ module Pubid::Core
|
|
12
12
|
# @param typed_stage_or_stage [String] typed stage or stage
|
13
13
|
# @return identifier's class
|
14
14
|
def resolve_identifier(parameters = {})
|
15
|
-
return @config.default_type.new(**parameters) if parameters[:type].nil? && parameters[:stage].nil?
|
15
|
+
return @config.default_type.new(**parameters.dup.tap { |h| h.delete(:type) }) if parameters[:type].nil? && parameters[:stage].nil?
|
16
16
|
|
17
17
|
@config.types.each do |identifier_type|
|
18
|
-
return identifier_type.new(**parameters) if identifier_type.type_match?(parameters)
|
18
|
+
return identifier_type.new(**parameters.dup.tap { |h| h.delete(:type) }) if identifier_type.type_match?(parameters)
|
19
19
|
end
|
20
20
|
|
21
21
|
# When stage is not typed stage and type is not defined
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|