relaton-index 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +8 -1
- data/lib/relaton/index/type.rb +19 -0
- data/lib/relaton/index/version.rb +1 -1
- data/lib/relaton/index.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: d43fbc7d91123a99bde7050b74ee42d38408a610d6aab858a3e9a032b41e2a26
|
4
|
+
data.tar.gz: d3655957e051b6b1d3f0d2d7a223fab43e63a0186fa946092446611804c1fc23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d70ce12c06d309f611949aa6c138e03093be574830cf0b13389f8d41849cfae16a7b150726d1a1d8ac1f3eb263e657b32143a2d5f2102412a2f106af6d80649
|
7
|
+
data.tar.gz: 20f183f6b0c279825bceddc016fb87449ce475983d08029c6152c7552528df4fe385c7d6ca0818add7c2cc64219651636be995009d7a5de3cbb62dbfa243f252
|
data/README.adoc
CHANGED
@@ -32,7 +32,7 @@ Relaton::Index.find_or_create :IHO, url: "https://raw.githubusercontent.com/rela
|
|
32
32
|
# Find an existing index object (created before).
|
33
33
|
Relaton::Index.find_or_create :IHO
|
34
34
|
|
35
|
-
# If
|
35
|
+
# If the URL or filename is specified and has a new value (different from what it was before), the index object will be recreated.
|
36
36
|
Relaton::Index.find_or_create :IHO, url: nil, filename: "index.yaml"
|
37
37
|
|
38
38
|
# Remove the index from the pool.
|
@@ -81,6 +81,13 @@ end
|
|
81
81
|
# => [{ id: "B-4 2.19.0", file: "data/b-4_2_19_0.xml" }]
|
82
82
|
----
|
83
83
|
|
84
|
+
=== Remove all index records
|
85
|
+
|
86
|
+
[source,ruby]
|
87
|
+
----
|
88
|
+
index.remove_all
|
89
|
+
----
|
90
|
+
|
84
91
|
=== Configuration
|
85
92
|
|
86
93
|
The gem can be configured by using the `Relaton::Index.config` method. The following settings are available:
|
data/lib/relaton/index/type.rb
CHANGED
@@ -18,6 +18,16 @@ module Relaton
|
|
18
18
|
@index = @file_io.read
|
19
19
|
end
|
20
20
|
|
21
|
+
#
|
22
|
+
# Check if index is actual. If url or file is given, check if it is equal to
|
23
|
+
# index url or file.
|
24
|
+
#
|
25
|
+
# @param [Hash] **args arguments
|
26
|
+
# @option args [String, nil] :url external URL to index, used to fetch index for searching files
|
27
|
+
# @option args [String, nil] :file output file name
|
28
|
+
#
|
29
|
+
# @return [Boolean] true if index is actual, false otherwise
|
30
|
+
#
|
21
31
|
def actual?(**args)
|
22
32
|
(!args.key?(:url) || args[:url] == @file_io.url) && (!args.key?(:file) || args[:file] == @file)
|
23
33
|
end
|
@@ -60,6 +70,15 @@ module Relaton
|
|
60
70
|
def save
|
61
71
|
@file_io.save @index
|
62
72
|
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Remove all index items
|
76
|
+
#
|
77
|
+
# @return [void]
|
78
|
+
#
|
79
|
+
def remove_all
|
80
|
+
@index = []
|
81
|
+
end
|
63
82
|
end
|
64
83
|
end
|
65
84
|
end
|
data/lib/relaton/index.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
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-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|