relaton-index 0.1.5 → 0.1.6

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: f1f22ce8f232dc77b5b791d5eaa6fb5b80bf62697f8a1a7cd9d18e7515ff7d65
4
- data.tar.gz: 86884150296d335342dba8ebf3c2808f662fd08709378ce9674e91965494c600
3
+ metadata.gz: d43fbc7d91123a99bde7050b74ee42d38408a610d6aab858a3e9a032b41e2a26
4
+ data.tar.gz: d3655957e051b6b1d3f0d2d7a223fab43e63a0186fa946092446611804c1fc23
5
5
  SHA512:
6
- metadata.gz: 3c59bccab496f4be0a8a7d228dcb676c148daf9e6d84308623d1877bd0fe85a6738a5f151219f787385ac53faae430f43bfa928b40e2e399d62082abcfb86600
7
- data.tar.gz: 33ef8426b9e9e72cfb2488d78ef16d65e5083d3a50376b9e530d95b213744c69763d9fa2fa4c39395cd3428fdf7e8954ea3a47047c2ce029b2cdbb580ff406a0
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 a new value of URL or filename is specified and has a new value (different from what it was before), the index object will be recreated.
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:
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Index
5
- VERSION = "0.1.5"
5
+ VERSION = "0.1.6"
6
6
  end
7
7
  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.5
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-03-11 00:00:00.000000000 Z
11
+ date: 2023-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip