relaton-index 0.1.5 → 0.1.7
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
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b98c8a3a2f93284d50aefe422e0fea795bf697c7f4cd4bce8fcf517ccd2f62
|
4
|
+
data.tar.gz: 63dbd9440f0cf7dbb58a043bce06940d1ac50e4a43513ab148ce292177a37f22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae44baa7e0019a6de91cdecbc23c5c832425f84fd53f2f9262fd7d295a4df8bf3e95d96628326561023a90c1fd9a90cb2cee6cd0e542033d011ce5975a2f2354
|
7
|
+
data.tar.gz: cef211d3dbf82b2105bfc3035a1f7d140ca41e9cd4a7a35559fd2709189dc36528a744d927ccf969cbc8827bb6405b3dda3659a273fda9794635ff4a11313e28
|
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
|
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.7
|
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-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.3.26
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Relaton Index is a library for indexing Relaton files.
|