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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0a18404c0b3197dd888ee8b286ec575e391327d0ad7c50645fb57adfa922b78
4
- data.tar.gz: 69bd5fc4c3dc70d2daf646debe653d899ebfd7bef691809c8ac31b4e49ebf1cf
3
+ metadata.gz: d43fbc7d91123a99bde7050b74ee42d38408a610d6aab858a3e9a032b41e2a26
4
+ data.tar.gz: d3655957e051b6b1d3f0d2d7a223fab43e63a0186fa946092446611804c1fc23
5
5
  SHA512:
6
- metadata.gz: 66c4fc49df2fcebbbb41913e55223d94b5058bde802b714381c1a91178d37d13904055a99aa5b5d5f87283d1248cdde6d86c309060f238a7988f538277de72db
7
- data.tar.gz: fa6fed8320e73cc1bea2ef9fbf3aec9640f9de5f62f79c03cb5a34ad2473c5bbd452008b1dd4ba275c47e844d75ca0d68351efc4c6fd67d0dc0cd284211e0465
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.4"
5
+ VERSION = "0.1.6"
6
6
  end
7
7
  end
data/lib/relaton/index.rb CHANGED
@@ -25,7 +25,7 @@ module Relaton
25
25
  # @return [Relaton::Index::Type] typed index
26
26
  #
27
27
  def find_or_create(type, url: nil, file: nil)
28
- pool.type(type, url, file)
28
+ pool.type(type, url: url, file: file)
29
29
  end
30
30
 
31
31
  def close(type)
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
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-10 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