relaton-iec 1.16.1 → 1.16.2

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: 22c30d32d348985a90f88d21872741162ebef459ccff4fc118597f196e53f4b9
4
- data.tar.gz: 5a265ce8efceee119c822824eb347ace8aeedd9f695b23b7270a22d150da3678
3
+ metadata.gz: d3c632b6fb62b15fd360d801190ebac6742f05658b695e573304b5c4a7d38ed1
4
+ data.tar.gz: 271d54825baa3cc59e59bcc926da577aecb172bb81466cb7b1dd5c4248746357
5
5
  SHA512:
6
- metadata.gz: f6f4575283e266b8f35c28b88ff70ec1653c35222e6283d62385c883c459a3a65b096b5ed7495b68a40f4b99760f2e741d59ce4c370556180d0e41bc3d04f529
7
- data.tar.gz: 76d9702d3434cf7a7c3b1dfc4e03e9be53ca2e49c801c5dc2060b7574e3d3c023ade59074daeb628a00eb57e1792860d8d35073228594baf0e897917d2b3c9d1
6
+ metadata.gz: 283f22a20fceef3a4dbb3430f8bbdb69930b8286f5af0e00bc8c1648242c6024603b2a284efa7ae7fcdcf908db0f326f48533ba5fbad8389f3e534428a9059b6
7
+ data.tar.gz: 8327e80d5c36f179d692966ebb280fc00c66e89145d1da741e3198b1219655df2a33ca45735870466c3b045ae7b3f8bce7ba663396af76e29b0bdbcf06b8359b
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]
@@ -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, " \
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.16.2".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.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: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2023-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable