pubid-iec 0.1.1 → 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: '092ecdd26535d1bf9d3b7c8aa11d9117ab2e0836d6a8659169f36979cdafcd54'
4
- data.tar.gz: 228f27369cfdb0130cfcacfebb8befa3c902becb3f5f701e27f5f0b893669a09
3
+ metadata.gz: e90bffa95ad22908d9e3ef94f932eef9de74d756db468b3112836d516f9f8e54
4
+ data.tar.gz: 9a7d4d1c1b2048d0153665638d87478f2d687797041b744b6e8ad5272a9be346
5
5
  SHA512:
6
- metadata.gz: b7f2b20b4e841616c650403f940521c7d13ad42065479331987f7af91b19d4f80502f168ba1c4f537ff4174aa5ff5178d0f07170547765eee694015edd4c2853
7
- data.tar.gz: cdbd7d923574793ade27a1523c4ff4c59dd14af8a8b50b04b9dc9f16086e537fb2314a27e24de89f23afc750eab3446cb4055abba77995845a0d838ff7bab1cf
6
+ metadata.gz: 00a7ca70d0ad437647fa173e5b6f024339cf7e49b7d6787981cac96c0898118b3c4a4f5b3cfbb1a6236aa5209f625a71edfb9237b75fcde3ebaf772f4d62a4b6
7
+ data.tar.gz: ae6df5364c9aa35c301c944a62b5c9a87d4139d47d0e1b8d1026e05fbdd1ad5c2d9b39ff57966aaba7544e6094c9fc7c53909bec3eb9207a5ad93310175fd137
@@ -0,0 +1,76 @@
1
+ module Pubid::Iec
2
+ class Base < Pubid::Core::Identifier::Base
3
+
4
+ attr_accessor :vap, :database, :fragment, :version, :decision_sheet,
5
+ :conjuction_part, :part_version, :trf_publisher,
6
+ :trf_series, :trf_version, :test_type
7
+
8
+ # @param stage [String] stage eg. "PWI", "PNW"
9
+ def initialize(publisher: "IEC", stage: nil, vap: nil, database: nil,
10
+ fragment: nil, version: nil, decision_sheet: nil,
11
+ conjuction_part: nil, part_version: nil, trf_publisher: nil,
12
+ trf_series: nil, trf_version: nil, test_type: nil,
13
+ edition: nil, type: nil, **args)
14
+ # @stage = stage.to_s if stage
15
+ # @stage = Stage.parse(stage) if stage
16
+
17
+ if stage
18
+ if stage.is_a?(Stage)
19
+ @stage = stage
20
+ else
21
+ @stage = Identifier.parse_stage(stage)
22
+ end
23
+ end
24
+
25
+ @vap = vap.to_s if vap
26
+ @database = database if database
27
+ @fragment = fragment if fragment
28
+ @version = version if version
29
+ @decision_sheet = decision_sheet if decision_sheet
30
+ @conjuction_part = conjuction_part if conjuction_part
31
+ @part_version = part_version if part_version
32
+ @trf_publisher = trf_publisher.to_s if trf_publisher
33
+ @trf_series = trf_series if trf_series
34
+ @trf_version = trf_version.to_s if trf_version
35
+ @test_type = test_type if test_type
36
+ @edition = edition.to_s if edition
37
+ @type = Identifier.build_type(type) if type
38
+
39
+ super(**args.merge(publisher: publisher))
40
+ end
41
+
42
+ def urn
43
+ Renderer::Urn.new(get_params).render
44
+ end
45
+
46
+ class << self
47
+ def get_amendment_class
48
+ Amendment
49
+ end
50
+
51
+ def get_corrigendum_class
52
+ Corrigendum
53
+ end
54
+
55
+ def get_parser_class
56
+ Parser
57
+ end
58
+
59
+ def get_renderer_class
60
+ Renderer::Pubid
61
+ end
62
+
63
+ def get_transformer_class
64
+ Transformer
65
+ end
66
+
67
+ def get_update_codes
68
+ UPDATE_CODES
69
+ end
70
+ end
71
+
72
+ def database
73
+ @database || false
74
+ end
75
+ end
76
+ end
@@ -1,67 +1,11 @@
1
1
  module Pubid::Iec
2
- class Identifier < Pubid::Core::Identifier
3
-
4
- attr_accessor :vap, :database, :fragment, :version, :decision_sheet,
5
- :conjuction_part, :part_version, :trf_publisher,
6
- :trf_series, :trf_version, :test_type
7
-
8
- # @param stage [String] stage eg. "PWI", "PNW"
9
- def initialize(publisher: "IEC", stage: nil, vap: nil, database: nil,
10
- fragment: nil, version: nil, decision_sheet: nil,
11
- conjuction_part: nil, part_version: nil, trf_publisher: nil,
12
- trf_series: nil, trf_version: nil, test_type: nil,
13
- edition: nil, type: nil, **args)
14
- # @stage = stage.to_s if stage
15
- @stage = Stage.parse(stage) if stage
16
- @vap = vap.to_s if vap
17
- @database = database if database
18
- @fragment = fragment if fragment
19
- @version = version if version
20
- @decision_sheet = decision_sheet if decision_sheet
21
- @conjuction_part = conjuction_part if conjuction_part
22
- @part_version = part_version if part_version
23
- @trf_publisher = trf_publisher.to_s if trf_publisher
24
- @trf_series = trf_series if trf_series
25
- @trf_version = trf_version.to_s if trf_version
26
- @test_type = test_type if test_type
27
- @edition = edition.to_s if edition
28
- @type = Type.parse(type) if type
29
-
30
- super(**args.merge(publisher: publisher))
31
- end
32
-
33
- def urn
34
- Renderer::Urn.new(get_params).render
35
- end
36
-
2
+ module Identifier
37
3
  class << self
38
- def get_amendment_class
39
- Amendment
40
- end
41
-
42
- def get_corrigendum_class
43
- Corrigendum
44
- end
45
-
46
- def get_parser_class
47
- Parser
48
- end
49
-
50
- def get_renderer_class
51
- Renderer::Pubid
52
- end
4
+ include Pubid::Core::Identifier
53
5
 
54
- def get_transformer_class
55
- Transformer
6
+ def parse(*args)
7
+ Base.parse(*args)
56
8
  end
57
-
58
- def get_update_codes
59
- UPDATE_CODES
60
- end
61
- end
62
-
63
- def database
64
- @database || false
65
9
  end
66
10
  end
67
11
  end
@@ -1,84 +1,15 @@
1
1
  module Pubid::Iec
2
- class Stage
3
- STAGES = { ACD: "20.99",
4
- ACDV: "30.99",
5
- ADTR: "40.99",
6
- ADTS: "40.99",
7
- AFDIS: "40.99",
8
- APUB: "50.99",
9
- BPUB: "60.00",
10
- CAN: "30.98",
11
- CCDV: "40.20",
12
- CD: "30.20",
13
- CDISH: "50.20",
14
- CDM: "30.60",
15
- CDPAS: "50.20",
16
- CDTR: "50.20",
17
- CDTS: "50.20",
18
- CDVM: "40.91",
19
- CFDIS: "50.20",
20
- DECDISH: "50.00",
21
- DECFDIS: "50.00",
22
- DECPUB: "60.00",
23
- DEL: "10.98",
24
- DELPUB: "99.60",
25
- DTRM: "50.92",
26
- DTSM: "50.92",
27
- MERGED: "30.97",
28
- NCDV: "40.91",
29
- NDTR: "50.92",
30
- NDTS: "50.92",
31
- NFDIS: "50.92",
32
- PCC: "30.60",
33
- PNW: "10.20",
34
- PPUB: "60.60",
35
- PRVC: "40.60",
36
- PRVD: "50.60",
37
- PRVDISH: "50.60",
38
- PRVDPAS: "50.60",
39
- PRVDTR: "50.60",
40
- PRVDTS: "50.60",
41
- PRVN: "10.60",
42
- PWI: "00.00",
43
- RDISH: "50.00",
44
- RFDIS: "50.00",
45
- RPUB: "60.00",
46
- SPLIT: "30.96",
47
- TCDV: "40.00",
48
- TDISH: "50.00",
49
- TDTR: "50.00",
50
- TDTS: "50.00",
51
- TPUB: "60.00",
52
- WPUB: "95.99"
53
- }.freeze
54
-
55
- attr_accessor :stage
56
-
57
- def initialize(stage)
58
- raise Errors::StageInvalidError, "#{stage} is not valid stage" unless STAGES.key?(stage.to_sym)
59
-
60
- @stage = stage
61
- end
2
+ class Stage < Pubid::Core::Stage
62
3
 
63
4
  def to_s(format = :short)
64
- return "" if nil?
5
+ return "" if empty_abbr?
65
6
 
66
7
  case format
67
8
  when :short
68
- @stage
9
+ abbr
69
10
  else
70
- STAGES[@stage.to_sym]
11
+ @harmonized_code.to_s
71
12
  end
72
13
  end
73
-
74
- def nil?
75
- @stage.nil?
76
- end
77
-
78
- def self.parse(stage)
79
- raise Errors::StageInvalidError unless stage.is_a?(Symbol) || stage.is_a?(String) || stage.is_a?(Parslet::Slice)
80
-
81
- Stage.new(stage.to_s)
82
- end
83
14
  end
84
15
  end
@@ -1,5 +1,5 @@
1
1
  module Pubid::Iec
2
- class TrfIdentifier < Identifier
2
+ class TrfIdentifier < Base
3
3
 
4
4
  attr_accessor :version, :decision_sheet,
5
5
  :conjuction_part, :part_version, :trf_publisher,
@@ -1,72 +1,22 @@
1
1
  module Pubid::Iec
2
- class Type
3
- attr_accessor :type
2
+ class Type < Pubid::Core::Type
4
3
 
5
- TYPE_NAMES = {
6
- is: {
7
- long: "International Standard",
8
- short: "IS",
9
- },
10
- ts: {
11
- long: "Technical Specification",
12
- short: "TS",
13
- },
14
- tr: {
15
- long: "Technical Report",
16
- short: "TR",
17
- },
18
- pas: {
19
- long: "Publicly Available Specification",
20
- short: "PAS",
21
- },
22
- srd: {
23
- short: "SRD",
24
- },
25
- tec: {
26
- short: "TEC",
27
- },
28
- sttr: {
29
- short: "STTR",
30
- },
31
- wp: {
32
- short: "WP",
33
- },
34
- guide: {
35
- long: "Guide",
36
- short: "Guide",
37
- },
38
- od: {
39
- short: "OD",
40
- },
41
- cs: {
42
- short: "CS",
43
- },
44
- ca: {
45
- short: "CA",
46
- },
47
- trf: {
48
- long: "Test Report Form",
49
- short: "TRF",
50
- }
4
+ # # Create new type
5
+ # # @param type [Symbol]
6
+ # def initialize(type = :is)
7
+ # type = type.to_s.downcase.to_sym unless type.is_a?(Symbol)
8
+ #
9
+ # raise Errors::WrongTypeError, "#{type} type is not available" unless TYPE_NAMES.key?(type)
10
+ #
11
+ # @type = type
12
+ # end
51
13
 
52
- }.freeze
53
-
54
- # Create new type
55
- # @param type [Symbol]
56
- def initialize(type = :is)
57
- type = type.to_s.downcase.to_sym unless type.is_a?(Symbol)
58
-
59
- raise Errors::WrongTypeError, "#{type} type is not available" unless TYPE_NAMES.key?(type)
60
-
61
- @type = type
62
- end
63
-
64
- def self.parse(type_string)
65
- TYPE_NAMES.each do |type, values|
66
- return new(type) if values[:short].upcase == type_string.to_s.upcase
67
- end
68
- raise Errors::ParseTypeError, "Cannot parse '#{type_string}' type"
69
- end
14
+ # def self.parse(type_string)
15
+ # TYPE_NAMES.each do |type, values|
16
+ # return new(type) if values[:short].upcase == type_string.to_s.upcase
17
+ # end
18
+ # raise Errors::ParseTypeError, "Cannot parse '#{type_string}' type"
19
+ # end
70
20
 
71
21
  def to_s(format = :short)
72
22
  TYPE_NAMES[type][format]
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Iec
3
- VERSION = "0.1.1".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
data/lib/pubid/iec.rb CHANGED
@@ -7,9 +7,10 @@ module Pubid
7
7
  end
8
8
  end
9
9
 
10
+ require "pubid-core"
10
11
  require_relative "iec/errors"
11
12
  require_relative "iec/stage"
12
- require_relative "iec/type"
13
+ # require_relative "iec/type"
13
14
  require_relative "iec/parser"
14
15
  require_relative "iec/trf_parser"
15
16
  require_relative "iec/amendment"
@@ -19,5 +20,58 @@ require_relative "iec/renderer/trf_pubid"
19
20
  require_relative "iec/renderer/urn"
20
21
  require_relative "iec/renderer/trf_urn"
21
22
  require_relative "iec/transformer"
22
- require_relative "iec/identifier"
23
+ require_relative "iec/identifier/base"
23
24
  require_relative "iec/trf_identifier"
25
+ require_relative "iec/identifier"
26
+
27
+ config = Pubid::Core::Configuration.new
28
+ config.stages = YAML.load_file(File.join(File.dirname(__FILE__), "../../stages.yaml"))
29
+ config.stage_class = Pubid::Iec::Stage
30
+ config.type_names = { is: {
31
+ long: "International Standard",
32
+ short: "IS",
33
+ },
34
+ ts: {
35
+ long: "Technical Specification",
36
+ short: "TS",
37
+ },
38
+ tr: {
39
+ long: "Technical Report",
40
+ short: "TR",
41
+ },
42
+ pas: {
43
+ long: "Publicly Available Specification",
44
+ short: "PAS",
45
+ },
46
+ srd: {
47
+ short: "SRD",
48
+ },
49
+ tec: {
50
+ short: "TEC",
51
+ },
52
+ sttr: {
53
+ short: "STTR",
54
+ },
55
+ wp: {
56
+ short: "WP",
57
+ },
58
+ guide: {
59
+ long: "Guide",
60
+ short: "Guide",
61
+ },
62
+ od: {
63
+ short: "OD",
64
+ },
65
+ cs: {
66
+ short: "CS",
67
+ },
68
+ ca: {
69
+ short: "CA",
70
+ },
71
+ trf: {
72
+ long: "Test Report Form",
73
+ short: "TRF",
74
+ }
75
+
76
+ }.freeze
77
+ Pubid::Iec::Identifier.set_config(config)
data/stages.yaml ADDED
@@ -0,0 +1,99 @@
1
+ abbreviations:
2
+ ACD: "20.99"
3
+ ACDV: "30.99"
4
+ ADTR: "40.99"
5
+ ADTS: "40.99"
6
+ AFDIS: "40.99"
7
+ APUB: "50.99"
8
+ BPUB: "60.00"
9
+ CAN: "30.98"
10
+ CCDV: "40.20"
11
+ CD: "30.20"
12
+ CDISH: "50.20"
13
+ CDM: "30.60"
14
+ CDPAS: "50.20"
15
+ CDTR: "50.20"
16
+ CDTS: "50.20"
17
+ CDVM: "40.91"
18
+ CFDIS: "50.20"
19
+ DECDISH: "50.00"
20
+ DECFDIS: "50.00"
21
+ DECPUB: "60.00"
22
+ DEL: "10.98"
23
+ DELPUB: "99.60"
24
+ DTRM: "50.92"
25
+ DTSM: "50.92"
26
+ MERGED: "30.97"
27
+ NCDV: "40.91"
28
+ NDTR: "50.92"
29
+ NDTS: "50.92"
30
+ NFDIS: "50.92"
31
+ PCC: "30.60"
32
+ PNW: "10.20"
33
+ PPUB: "60.60"
34
+ PRVC: "40.60"
35
+ PRVD: "50.60"
36
+ PRVDISH: "50.60"
37
+ PRVDPAS: "50.60"
38
+ PRVDTR: "50.60"
39
+ PRVDTS: "50.60"
40
+ PRVN: "10.60"
41
+ PWI: "00.00"
42
+ RDISH: "50.00"
43
+ RFDIS: "50.00"
44
+ RPUB: "60.00"
45
+ SPLIT: "30.96"
46
+ TCDV: "40.00"
47
+ TDISH: "50.00"
48
+ TDTR: "50.00"
49
+ TDTS: "50.00"
50
+ TPUB: "60.00"
51
+ WPUB: "95.99"
52
+
53
+ codes_description:
54
+ "00.00": Proposal for new project received
55
+ "00.20": Proposal for new project under review
56
+ "00.60": Close of review
57
+ "00.98": Proposal for new project abandoned
58
+ "00.99": Approval to ballot proposal for new project
59
+ "10.00": Proposal for new project registered
60
+ "10.20": New project ballot initiated
61
+ "10.60": Close of voting
62
+ "10.92": Proposal returned to submitter for further definition
63
+ "10.98": New project rejected
64
+ "10.99": New project approved
65
+ "20.00": New project registered in TC/SC work programme
66
+ "20.20": Working draft (WD) study initiated
67
+ "20.60": Close of comment period
68
+ "20.98": Project deleted
69
+ "20.99": WD approved for registration as CD
70
+ "30.00": Committee draft (CD) registered
71
+ "30.20": CD study/ballot initiated
72
+ "30.60": Close of voting/ comment period
73
+ "30.92": CD referred back to Working Group
74
+ "30.98": Project deleted
75
+ "30.99": CD approved for registration as DIS
76
+ "40.00": DIS registered
77
+ "40.20": "DIS ballot initiated: 12 weeks"
78
+ "40.60": Close of voting
79
+ "40.93": "Full report circulated: decision for new DIS ballot"
80
+ "40.98": Project deleted
81
+ "40.92": "Full report circulated: DIS referred back to TC or SC"
82
+ "40.99": "Full report circulated: DIS approved for registration as FDIS"
83
+ "50.00": Final text received or FDIS registered for formal approval
84
+ "50.20": "Proof sent to secretariat or FDIS ballot initiated: 8 weeks"
85
+ "50.60": Close of voting. Proof returned by secretariat
86
+ "50.92": FDIS or proof referred back to TC or SC
87
+ "50.98": Project deleted
88
+ "50.99": FDIS or proof approved for publication
89
+ "60.00": International Standard under publication
90
+ "60.60": International Standard published
91
+ "90.20": International Standard under systematic review
92
+ "90.60": Close of review
93
+ "90.92": International Standard to be revised
94
+ "90.93": International Standard confirmed
95
+ "90.99": Withdrawal of International Standard proposed by TC or SC
96
+ "95.20": Withdrawal ballot initiated
97
+ "95.60": Close of voting
98
+ "95.92": Decision not to withdraw International Standard
99
+ "95.99": Withdrawal of International Standard
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.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-09 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.4.0
61
+ version: 1.6.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.4.0
68
+ version: 1.6.1
69
69
  description: Library to generate, parse and manipulate IEC PubID.
70
70
  email:
71
71
  - open.source@ribose.com
@@ -83,6 +83,7 @@ files:
83
83
  - lib/pubid/iec/corrigendum.rb
84
84
  - lib/pubid/iec/errors.rb
85
85
  - lib/pubid/iec/identifier.rb
86
+ - lib/pubid/iec/identifier/base.rb
86
87
  - lib/pubid/iec/parser.rb
87
88
  - lib/pubid/iec/renderer/pubid.rb
88
89
  - lib/pubid/iec/renderer/trf_pubid.rb
@@ -94,6 +95,7 @@ files:
94
95
  - lib/pubid/iec/trf_parser.rb
95
96
  - lib/pubid/iec/type.rb
96
97
  - lib/pubid/iec/version.rb
98
+ - stages.yaml
97
99
  - update_codes.yaml
98
100
  homepage: https://github.com/metanorma/pubid-iec
99
101
  licenses: