pubid-core 1.6.0 → 1.7.0

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: b85bcef46a9327cb4c9ae474a84dea3b3986990082459b2f2bb37aa1c7578861
4
- data.tar.gz: b7caa4de8dd3ac5c9e9b0d9bed0f3690207f48b5ec6366d4515a2ab138ab5b92
3
+ metadata.gz: bd421b7145aba335def612737e0623052e982465c453e4afa7f1b4ceb594b93b
4
+ data.tar.gz: c2ac27fb623b17a75b99a19ebda2f76eb435b0c49030d1196fb7bcabb1b078ff
5
5
  SHA512:
6
- metadata.gz: 70ab4b5c6c3393811c898e3d66dbb9c1f1f80b34a5f9337697748ef06a6ee5f3331828b731b776fedeb44379c7766dda901cca146e15ba62731b17258e7d7cb5
7
- data.tar.gz: 518912efd803e1ee6cef6d189fd618f4f52300109d057b35f9061437a199488b74c09cf2cafbb9622fe9a49c4e8fd7a0cea96e4e2861f53b6014e06277444c80
6
+ metadata.gz: 9075f028fa92e30ca75a48ee8dec47cc89ede6939c4ba9a0e4b52bf8ea2909d91d3c9696ab9f3aa4a0da7963a0a7e2e521a2bc8222675cdc55107352c703ccc3
7
+ data.tar.gz: 77749d0dc8d056906215f59878d1b37c41b555260139c1b2bdff108f8fdc7fb5d81249c258f1b49645d8143c19fd342707c88045734e6b3383fd1fd567799c9b
@@ -1,6 +1,10 @@
1
1
  module Pubid::Core
2
2
  class Configuration
3
- attr_accessor :stages, :default_type, :type_class, :types, :type_names
3
+ attr_accessor :stages, :default_type, :type_class, :types, :type_names, :stage_class
4
4
 
5
+ def initialize
6
+ @type_class = Pubid::Core::Type
7
+ @stage_class = Pubid::Core::Stage
8
+ end
5
9
  end
6
10
  end
@@ -44,15 +44,15 @@ module Pubid::Core
44
44
  end
45
45
 
46
46
  def build_stage(**args)
47
- Stage.new(config: @config, **args)
47
+ @config.stage_class.new(config: @config, **args)
48
48
  end
49
49
 
50
50
  def parse_stage(stage)
51
- Stage.parse(stage, config: @config)
51
+ @config.stage_class.parse(stage, config: @config)
52
52
  end
53
53
 
54
54
  def has_stage?(stage)
55
- Stage.has_stage?(stage, config: @config)
55
+ @config.stage_class.has_stage?(stage, config: @config)
56
56
  end
57
57
 
58
58
  def build_type(type, **args)
@@ -78,11 +78,7 @@ module Pubid::Core::Renderer
78
78
  # @param with_date [Boolean] include year in output
79
79
  # @param with_language_code [:iso,:single] render document language as 2-letter ISO 639-1 language code or single code
80
80
  def render(with_date: true, with_language_code: :iso, **args)
81
- if %i(amd cor).include? @params[:type]&.type
82
- render_supplement(@params, **args.merge({ with_date: with_date, with_language_code: with_language_code}))
83
- else
84
- render_base_identifier(**args.merge({ with_date: with_date, with_language_code: with_language_code})) + @prerendered_params[:language].to_s
85
- end
81
+ render_base_identifier(**args.merge({ with_date: with_date, with_language_code: with_language_code})) + @prerendered_params[:language].to_s
86
82
  end
87
83
 
88
84
  def render_identifier(params)
@@ -56,11 +56,11 @@ module Pubid::Core
56
56
 
57
57
  def self.parse(stage, config:)
58
58
  if /\A[\d.]+\z/.match?(stage)
59
- Stage.new(harmonized_code: stage, config: config)
59
+ new(harmonized_code: stage, config: config)
60
60
  else
61
61
  raise Errors::StageInvalidError unless stage.is_a?(Symbol) || stage.is_a?(String) || stage.is_a?(Parslet::Slice)
62
62
 
63
- Stage.new(abbr: stage.to_s, config: config)
63
+ new(abbr: stage.to_s, config: config)
64
64
  end
65
65
  end
66
66
 
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Core
3
- VERSION = "1.6.0".freeze
3
+ VERSION = "1.7.0".freeze
4
4
  end
5
5
  end
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.6.0
4
+ version: 1.7.0
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-03-18 00:00:00.000000000 Z
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake