relaton-iec 1.16.1 → 1.16.3

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: 22c30d32d348985a90f88d21872741162ebef459ccff4fc118597f196e53f4b9
4
- data.tar.gz: 5a265ce8efceee119c822824eb347ace8aeedd9f695b23b7270a22d150da3678
3
+ metadata.gz: f56f331501e59dbf8da01e6444c93abf2bb7df8ec1dc2ed7ce12d2db4499ffbe
4
+ data.tar.gz: 6a2f4faf1ebddfa0c6909816eb6f4876fc57c2fdefec52e2a1fb9250706eebbd
5
5
  SHA512:
6
- metadata.gz: f6f4575283e266b8f35c28b88ff70ec1653c35222e6283d62385c883c459a3a65b096b5ed7495b68a40f4b99760f2e741d59ce4c370556180d0e41bc3d04f529
7
- data.tar.gz: 76d9702d3434cf7a7c3b1dfc4e03e9be53ca2e49c801c5dc2060b7574e3d3c023ade59074daeb628a00eb57e1792860d8d35073228594baf0e897917d2b3c9d1
6
+ metadata.gz: ada90e3aabddb40bc0e780d4959b7182f13b560741cf8058a000c1e372813d0023366f5835217a54afd4ef8149bf913e12c3084f2818031ca6eaa8fdf096f457
7
+ data.tar.gz: e1386d61a2525dee63591cb02abbcc728ad28d9d4f87758ec2f39aba6aedf37be1f05ecd9ab09af2c487481ca8025ae2d4d8b37a027bccad82a44f8017317435
data/README.adoc CHANGED
@@ -31,6 +31,20 @@ Or install it yourself as:
31
31
 
32
32
  == Usage
33
33
 
34
+ === Configuration
35
+
36
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonIec.configure` block.
37
+
38
+ [source,ruby]
39
+ ----
40
+ require 'relaton_iec'
41
+ => true
42
+
43
+ RelatonIec.configure do |config|
44
+ config.logger.level = Logger::DEBUG
45
+ end
46
+ ----
47
+
34
48
  === Search for a standard using keywords
35
49
 
36
50
  `RelatonIec::IecBibliography.search(ref, year)` method returns hits collection. Each hit can be used to fetch a document.
@@ -40,9 +54,6 @@ Or install it yourself as:
40
54
 
41
55
  [source,ruby]
42
56
  ----
43
- require 'relaton_iec'
44
- => true
45
-
46
57
  hit_collection = RelatonIec::IecBibliography.search("60050")
47
58
  => <RelatonIec::HitCollection:0x007fe0d7126f28 @ref=60050 @fetched=false>
48
59
 
@@ -78,14 +89,14 @@ item.docidentifier.detect { |di| di.type == "URN" }.id
78
89
  [source,ruby]
79
90
  ----
80
91
  item = RelatonIec::IecBibliography.get("IEC 60050-112:2010")
81
- [relaton-iec] ("IEC 60050-112:2010") fetching...
82
- [relaton-iec] ("IEC 60050-112:2010") found IEC 60050-112:2010
92
+ [relaton-iec] (IEC 60050-112:2010) Fetching from Relaton repository ...
93
+ [relaton-iec] (IEC 60050-112:2010) Found: `IEC 60050-112:2010`
83
94
  => #<RelatonIec::IecBibliographicItem:0x00007f876525e8d0
84
95
  ...
85
96
 
86
97
  item = RelatonIec::IecBibliography.get("IEC 60050-112", "2010", all_parts: true)
87
- [relaton-iec] ("IEC 60050-112") fetching...
88
- [relaton-iec] ("IEC 60050-112") found IEC 60050 (all parts)
98
+ [relaton-iec] (IEC 60050-112) Fetching from Relaton repository ...
99
+ [relaton-iec] (IEC 60050-112) Found: `IEC 60050 (all parts)`
89
100
  => #<RelatonIec::IecBibliographicItem:0x00007f87851888f0
90
101
  ...
91
102
 
@@ -93,8 +104,8 @@ item.docidentifier.first
93
104
  => #<RelatonBib::DocumentIdentifier:0x00007f878518eea8 @id="IEC 60050 (all parts)", @language=nil, @primary=true, @scope=nil, @script=nil, @type="IEC">
94
105
 
95
106
  item = RelatonIec::IecBibliography.get("IEC 60050-112", "2010")
96
- [relaton-iec] ("IEC 60050-112") fetching...
97
- [relaton-iec] ("IEC 60050-112") found IEC 60050-112:2010
107
+ [relaton-iec] (IEC 60050-112) Fetching from Relaton repository ...
108
+ [relaton-iec] (IEC 60050-112) Found: `IEC 60050-112:2010`
98
109
  => #<RelatonIec::IecBibliographicItem:0x007fa69f296da8
99
110
 
100
111
  item.docidentifier.first
@@ -13,12 +13,12 @@ module BasicBlock
13
13
  @mimetype = mimetype
14
14
  @filename = args[:filename]
15
15
  if args[:width] && !args[:width].is_a?(Integer) && args[:width] != "auto"
16
- warn "[basic-block] WARNING: invalid image width attribute \"#{args[:width]}"
17
- warn "[basic-block] image width should be integer or \"auto\""
16
+ warn "[basic-block] WARNING: Invalid image width attribute: \"#{args[:width]}"
17
+ warn "[basic-block] Image width should be integer or \"auto\""
18
18
  end
19
19
  if args[:height] && !args[:height].is_a?(Integer) && args[:height] != "auto"
20
- warn "[basic-block] WARNING: invalid image height attribute \"#{args[:height]}"
21
- warn "[basic-block] image height should be integer or \"auto\""
20
+ warn "[basic-block] WARNING: Invalid image height attribute: \"#{args[:height]}"
21
+ warn "[basic-block] Image height should be integer or \"auto\""
22
22
  end
23
23
  @width = args[:width]
24
24
  @height = args[:height]
@@ -4,7 +4,7 @@ module RelatonIec
4
4
  end
5
5
 
6
6
  def self.method_missing(_method, *args)
7
- ReferenceFormat.new *args
7
+ ReferenceFormat.new(*args)
8
8
  end
9
9
 
10
10
  class ReferenceFormat
@@ -15,8 +15,8 @@ module RelatonIec
15
15
  #
16
16
  def initialize(format)
17
17
  unless FORMATS.include? format
18
- warn "[relaton-iec] WARNING: invalid reference format \"#{format}\""
19
- warn "[relaton-iec] alloved reference formats are: #{FORMATS.join ', '}"
18
+ warn "[relaton-iec] WARNING: Invalid reference format: \"#{format}\""
19
+ warn "[relaton-iec] Alloved reference formats are: #{FORMATS.join ', '}"
20
20
  end
21
21
  @format = format
22
22
  end
@@ -11,8 +11,8 @@ module BasicBlock
11
11
  #
12
12
  def initialize(type:, content: [])
13
13
  unless TYPES.include? type
14
- warn "[relaton-iec] WARNING: invalud type \"#{type}\""
15
- warn "[relaton-iec] allowed types are: #{TYPES.join ', '}"
14
+ warn "[relaton-iec] WARNING: Invalud type: \"#{type}\""
15
+ warn "[relaton-iec] Allowed types are: #{TYPES.join ', '}"
16
16
  end
17
17
  @type = type
18
18
  @content = content
@@ -34,13 +34,13 @@ module RelatonIec
34
34
  #
35
35
  def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
36
36
  if args[:function] && !FUNCTION.include?(args[:function])
37
- Util.warn "WARNING: invalid function `#{args[:function]}`"
38
- Util.warn "allowed function values are: `#{FUNCTION.join('`, `')}`"
37
+ Util.warn "WARNING: Invalid function: `#{args[:function]}`"
38
+ Util.warn "Allowed function values are: `#{FUNCTION.join('`, `')}`"
39
39
  end
40
40
  if args[:updates_document_type] &&
41
41
  !DOCTYPES.include?(args[:updates_document_type])
42
- Util.warn "WARNING: invalid updates_document_type `#{args[:updates_document_type]}`"
43
- Util.warn "allowed updates_document_type values are: `#{DOCTYPES.join('`, `')}`"
42
+ Util.warn "WARNING: Invalid updates_document_type: `#{args[:updates_document_type]}`"
43
+ Util.warn "Allowed updates_document_type values are: `#{DOCTYPES.join('`, `')}`"
44
44
  end
45
45
  @function = args.delete :function
46
46
  @updates_document_type = args.delete :updates_document_type
@@ -56,7 +56,7 @@ module RelatonIec
56
56
  def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
57
57
  id = ref_with_year(code, year)
58
58
 
59
- Util.warn "(#{id}) Not found. The identifier must be exactly as shown on the IEC Webstore."
59
+ Util.warn "(#{id}) Not found."
60
60
 
61
61
  if year && missed_years.any?
62
62
  warn_missing_years(code, year, missed_years)
@@ -89,7 +89,7 @@ module RelatonIec
89
89
  # @param year [String]
90
90
  # @return [String]
91
91
  def ref_with_year(ref, year)
92
- year ? [ref, year].join(":") : ref
92
+ year && !ref.match?(/:\d{4}/) ? [ref, year].join(":") : ref
93
93
  end
94
94
 
95
95
  # @param ref [String]
@@ -125,7 +125,7 @@ module RelatonIec
125
125
  # @return [RelatonIec::HitCollection]
126
126
  def search_filter(ref, year)
127
127
  code = ref.split(":").first
128
- Util.warn "(#{ref_with_year(ref, year)}) Fetching from IEC..."
128
+ Util.warn "(#{ref_with_year(ref, year)}) Fetching from Relaton repsitory ..."
129
129
  search(code)
130
130
  end
131
131
 
@@ -250,9 +250,10 @@ module RelatonIec
250
250
  id = ref_with_year(code, year)
251
251
  docid = ret[:ret].docidentifier.first.id
252
252
 
253
- if id == docid then Util.warn "(#{id}) Found exact match."
254
- else Util.warn "(#{id}) Found `#{docid}`."
255
- end
253
+ # if id == docid then Util.warn "(#{id}) Found exact match."
254
+ # else
255
+ Util.warn "(#{id}) Found: `#{docid}`"
256
+ # end
256
257
 
257
258
  if ret[:missed_parts]
258
259
  Util.warn "(#{id}) TIP: `#{code}` also contains other parts, " \
@@ -5,7 +5,7 @@ module RelatonIec
5
5
  def initialize
6
6
  @short = :relaton_iec
7
7
  @prefix = "IEC"
8
- @defaultprefix = %r{^IEC\s|^IEV($|\s)}
8
+ @defaultprefix = %r{^(IEC\s|CISPR\s|IEV($|\s))}
9
9
  @idtype = "IEC"
10
10
  @datasets = %w[iec-harmonized-all iec-harmonized-latest]
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.16.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.16.3
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-09-21 00:00:00.000000000 Z
11
+ date: 2023-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable