relaton-iec 1.16.1 → 1.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +20 -9
- data/lib/relaton_iec/basic_block/image.rb +4 -4
- data/lib/relaton_iec/basic_block/reference_format.rb +2 -2
- data/lib/relaton_iec/basic_block/stem.rb +2 -2
- data/lib/relaton_iec/iec_bibliographic_item.rb +4 -4
- data/lib/relaton_iec/iec_bibliography.rb +7 -6
- data/lib/relaton_iec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c632b6fb62b15fd360d801190ebac6742f05658b695e573304b5c4a7d38ed1
|
4
|
+
data.tar.gz: 271d54825baa3cc59e59bcc926da577aecb172bb81466cb7b1dd5c4248746357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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] (
|
82
|
-
[relaton-iec] (
|
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] (
|
88
|
-
[relaton-iec] (
|
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] (
|
97
|
-
[relaton-iec] (
|
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:
|
17
|
-
warn "[basic-block]
|
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:
|
21
|
-
warn "[basic-block]
|
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:
|
19
|
-
warn "[relaton-iec]
|
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:
|
15
|
-
warn "[relaton-iec]
|
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:
|
38
|
-
Util.warn "
|
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:
|
43
|
-
Util.warn "
|
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.
|
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
|
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
|
-
|
255
|
-
|
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, " \
|
data/lib/relaton_iec/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|