relaton 1.0.1 → 1.0.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: d4202b2e4642a7a5b525e0b8f6235cc4f864e0410edb8e2e7f3db2f545509bb4
4
- data.tar.gz: a3fb5c7e6920104636034aa25669b61a29b30a61e9a5b5af311455d9426eba68
3
+ metadata.gz: 3ef8be5b24a3eccd56e2682afb69d1e7e810bfd67068d9e3c6bd875603777650
4
+ data.tar.gz: ac234a78943683f1b7d18bb5df3139eefe214f4f842dd0567f1646200ca7ee36
5
5
  SHA512:
6
- metadata.gz: 88183a6c500542044135ac366130c0dbba850f867dcc4c850af16d1de3d4a4b618bdc175c5854d82676494f5224c6a66cf99ae459e9d477515d7cc9a494b4d28
7
- data.tar.gz: 88511e0108941e807202c38ec4f436734ebd8bf3cec8c6b7cbbe75a1e3a7d0cf4759828ef780a791f68f855d860f97db83fc7d74b96878125debce5537c1f305
6
+ metadata.gz: 493e4ed525d7c34e23aa20ab2271c69d3f41b7b3a007dd7981f7549810c1d13960a069c0bc46e195da5e97c38cc739cc3a36c56cbe10f74e0b25f5bc51f8c250
7
+ data.tar.gz: 2607311660b450c97b903f48621ef97e748c477083c772430753569fe4b4eb1366710ca2724b14a42f96148a1bb6cfa4962453f0ad1f14b3683a58f28e63c35a
@@ -123,7 +123,7 @@ module Relaton
123
123
  # @return [Array]
124
124
  def strip_id_wrapper(code, stdclass)
125
125
  prefix = @registry.processors[stdclass].prefix
126
- code = code.sub(/^#{prefix}\((.+)\)$/, "\\1")
126
+ code = code.sub(/\u2013/, "-").sub(/^#{prefix}\((.+)\)$/, "\\1")
127
127
  [prefix, code]
128
128
  end
129
129
 
@@ -24,15 +24,19 @@ module Relaton
24
24
  end
25
25
 
26
26
  prefix_dir = "#{@dir}/#{prefix(key)}"
27
- unless Dir.exist? prefix_dir
28
- FileUtils::mkdir_p prefix_dir
29
- end
27
+ FileUtils::mkdir_p prefix_dir unless Dir.exist? prefix_dir
30
28
  set_version prefix_dir
31
- ex = if value =~ /^not_found/ then "notfound"
32
- elsif value =~ /^redirection/ then "redirect"
33
- else @ext
34
- end
35
- File.write "#{filename(key)}.#{ex}", value, encoding: "utf-8"
29
+ File.write "#{filename(key)}.#{ext(value)}", value, encoding: "utf-8"
30
+ end
31
+
32
+ # @param value [String]
33
+ # @return [String]
34
+ def ext(value)
35
+ case value
36
+ when /^not_found/ then "notfound"
37
+ when /^redirection/ then "redirect"
38
+ else @ext
39
+ end
36
40
  end
37
41
 
38
42
  # Read item
@@ -163,7 +167,8 @@ module Relaton
163
167
  end
164
168
 
165
169
  #
166
- # Checks if there is file with xml or txt extension and return filename with the extension.
170
+ # Checks if there is file with xml or txt extension and return filename with
171
+ # the extension.
167
172
  #
168
173
  # @param file [String]
169
174
  # @return [String, NilClass]
@@ -181,9 +186,6 @@ module Relaton
181
186
  # @param key [String]
182
187
  # @return [String]
183
188
  def prefix(key)
184
- # @registry.processors.detect do |_n, p|
185
- # /^#{p.prefix}/.match(key) || processor.defaultprefix.match(key)
186
- # end[1].prefix.downcase
187
189
  key.downcase.match(/^[^\(]+(?=\()/).to_s
188
190
  end
189
191
 
@@ -204,8 +206,8 @@ module Relaton
204
206
  public
205
207
 
206
208
  # Initialse and return relaton instance, with local and global cache names
207
- # local_cache: local cache name; none created if nil; "relaton" created if empty
208
- # global_cache: boolean to create global_cache
209
+ # local_cache: local cache name; none created if nil; "relaton" created
210
+ # if empty global_cache: boolean to create global_cache
209
211
  # flush_caches: flush caches
210
212
  def init_bib_caches(opts)
211
213
  globalname = global_bibliocache_name if opts[:global_cache]
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton-calconnect