pubid-itu 0.1.0 → 0.1.2

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: ec23750bf87a608ae22678e7e96c322d2cbd0c2e89b811a79b128e3f85e0e3ae
4
- data.tar.gz: 3501fd05683d1cc766e90133f67cdd6b1e4b184347989c4797cad33f2103d8d5
3
+ metadata.gz: 4b6a9f43860cc646babf95c556cf4aa0169f847a26415503bfa0458dd0af9af1
4
+ data.tar.gz: 6e5c30a16a55c467bb5b1d4ce00c2e6bbc7dec182b5e40815c8e8146669a10a7
5
5
  SHA512:
6
- metadata.gz: a7ae4e27f6e021070bef704c348c3bed515ac1963a2cfb1dd469e879d6af574da0cc8a70e7ed8e22ca75c8585381b5031293f4e2dfafdf7adc99f05171859c82
7
- data.tar.gz: 434c0efa0b8d6a6dff44c6f37d6a739f7d93a8745ba2fc1d1b6bda3e9b4678a48631b6c2eb5ff5be84d3a9d81c9b7c8750b5b32aead241351e1eb70d346179a5
6
+ metadata.gz: 4049ed45d386a01a4670397674340e7c287186399c4e4b417e54b21b902b4518cc5c8660b081ee1f53e6a9cc08d947cbb7a9a0730fd7d17e0cd04aed367ec94d
7
+ data.tar.gz: c6fd2a5ad473a2325063b1112f578376d8a01947ddfdca133113a420a8357b2bdbd670b2583239ee70959fe41b80bf868dfd48e22b63215affa379d2ee55065d
@@ -31,7 +31,7 @@ module Pubid::Itu
31
31
  end
32
32
 
33
33
  def to_s(**opts)
34
- self.class.get_renderer_class.new(get_params).render(**opts)
34
+ self.class.get_renderer_class.new(to_h(deep: false)).render(**opts)
35
35
  end
36
36
 
37
37
  class << self
@@ -3,11 +3,6 @@ module Pubid::Itu
3
3
  class Recommendation < Base
4
4
  def_delegators 'Pubid::Itu::Identifier::Recommendation', :type
5
5
 
6
- def initialize(**opts)
7
- # add type when Recommendation is default type
8
- super(**opts.merge(type: "REC"))
9
- end
10
-
11
6
  def self.type
12
7
  { key: :recommendation, title: "Recommendation", short: "REC" }
13
8
  end
@@ -10,10 +10,10 @@ module Pubid::Itu
10
10
  @base = base
11
11
  end
12
12
 
13
- def get_params
13
+ def to_h(deep: false)
14
14
  # XXX: hack to render supplements using Base renderer, because we need to
15
15
  # place date published after amendment, e.g. `ITU-T G.780/Y.1351 Amd 1 (2004)`
16
- @base.get_params.merge(self.type[:key] => super)
16
+ @base.to_h(deep: deep).merge(self.type[:key] => super)
17
17
  end
18
18
 
19
19
  def self.type
@@ -102,10 +102,14 @@ module Pubid::Itu
102
102
  roman_numerals.as(:number)).as(:appendix)
103
103
  end
104
104
 
105
+ rule(:language) do
106
+ str("-") >> match["EFASCR"].as(:language)
107
+ end
108
+
105
109
  rule(:identifier) do
106
110
  str("ITU") >> (dash | space) >> sector_series_number >> supplement.maybe >>
107
111
  annex.maybe >> corrigendum.maybe >> addendum.maybe >> appendix.maybe >>
108
- published.maybe >> amendment.maybe >> str("-I").maybe
112
+ published.maybe >> amendment.maybe >> str("-I").maybe >> language.maybe
109
113
  end
110
114
 
111
115
  rule(:root) { identifier }
@@ -85,5 +85,9 @@ module Pubid::Itu::Renderer
85
85
  def render_appendix(appendix, _opts, _params)
86
86
  " App. #{appendix[:number]}"
87
87
  end
88
+
89
+ def render_language(language, _opts, _params)
90
+ "-#{LANGUAGES[language]}"
91
+ end
88
92
  end
89
93
  end
@@ -1,15 +1,11 @@
1
1
  module Pubid::Itu::Renderer
2
2
  class ImplementersGuide < Base
3
3
  def render_type_series(params)
4
- "%{series}%{type}" % params
4
+ ("%{series}" % params) + (params[:series] ? ".Imp" : "Imp")
5
5
  end
6
6
 
7
7
  def render_number(number, _opts, params)
8
8
  number
9
9
  end
10
-
11
- def render_type(type, opts, _params)
12
- params[:series] ? ".Imp" : "Imp"
13
- end
14
10
  end
15
11
  end
@@ -3,5 +3,9 @@ module Pubid::Itu
3
3
  rule(series: "Operational Bulletin") do
4
4
  { series: "OB" }
5
5
  end
6
+
7
+ rule(language: simple(:language)) do
8
+ { language: LANGUAGES.key(language) }
9
+ end
6
10
  end
7
11
  end
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Itu
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.1.2".freeze
4
4
  end
5
5
  end
data/lib/pubid/itu.rb CHANGED
@@ -5,7 +5,14 @@ require "yaml"
5
5
 
6
6
  module Pubid
7
7
  module Itu
8
-
8
+ LANGUAGES = {
9
+ "ru": "R",
10
+ "fr": "F",
11
+ "en": "E",
12
+ "ar": "A",
13
+ "es": "S",
14
+ "zh": "C",
15
+ }.freeze
9
16
  end
10
17
  end
11
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
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-01-06 00:00:00.000000000 Z
11
+ date: 2024-03-29 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.8.5
61
+ version: 1.12.2
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.8.5
68
+ version: 1.12.2
69
69
  description: Library to generate, parse and manipulate ITU PubID.
70
70
  email:
71
71
  - open.source@ribose.com