relaton-index 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f22ce8f232dc77b5b791d5eaa6fb5b80bf62697f8a1a7cd9d18e7515ff7d65
4
- data.tar.gz: 86884150296d335342dba8ebf3c2808f662fd08709378ce9674e91965494c600
3
+ metadata.gz: 94b98c8a3a2f93284d50aefe422e0fea795bf697c7f4cd4bce8fcf517ccd2f62
4
+ data.tar.gz: 63dbd9440f0cf7dbb58a043bce06940d1ac50e4a43513ab148ce292177a37f22
5
5
  SHA512:
6
- metadata.gz: 3c59bccab496f4be0a8a7d228dcb676c148daf9e6d84308623d1877bd0fe85a6738a5f151219f787385ac53faae430f43bfa928b40e2e399d62082abcfb86600
7
- data.tar.gz: 33ef8426b9e9e72cfb2488d78ef16d65e5083d3a50376b9e530d95b213744c69763d9fa2fa4c39395cd3428fdf7e8954ea3a47047c2ce029b2cdbb580ff406a0
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 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.7"
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.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-03-11 00:00:00.000000000 Z
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.1.6
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.