relaton-index 0.2.2 → 0.2.3

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: bc21a3161ae2d23d6b2178a5947d07c83dd1758f6db4e093340b90f525968edd
4
- data.tar.gz: 8bf654f9260aff06bb3be34e6b14a35adf1280e5d90085a57fc3c608db976b94
3
+ metadata.gz: 21befc44c8bd8f0d88e60fe51d5aa5be78e12b8a5857a27ce618bd561ee1aa88
4
+ data.tar.gz: c527ce0b9894779d32ccb355f435c8d22b0c7d34355bd8f65bffce58c9512859
5
5
  SHA512:
6
- metadata.gz: faf0f893ec70ae6c5186e6fa2afe5619d9ab4757d6fef73f1637163690a1a371df999e4d85a5af896e8ae2bae479d690891bedc704f5227aa55d52a02f582217
7
- data.tar.gz: b9cf08da7a80849861da0c999d0d603d0b8c1466b93ed0e898d1bdb670bb5e49eb82ce592ba75d0d276d28d0309c3e85cccf5d317263791b16784132b55da8cf
6
+ metadata.gz: c6984ef1228e1ac5c862c0ed68ba6a8e8c841b9c758fc37d0b32178d8c63bfee6423f169b12c2f80bdb438bbc33596559c980fb8267887aa4f7ccab6d1e87357
7
+ data.tar.gz: cda24cb6adef4dab6a51f16b78ed54d239cc76daa41e8ae76a4d2f442b0ec5d430be5da4fd0e8141f21860126f0ebce630d5e828c768b46320e7eb621885a98d
@@ -75,15 +75,20 @@ module Relaton
75
75
  #
76
76
  # @return [Boolean] <description>
77
77
  #
78
- def check_format(index) # rubocop:disable Metrics/AbcSize
79
- keys = index.reduce(Set.new) do |acc, item|
80
- if item[:id].is_a?(Hash) && @id_keys.any?
81
- acc + item.keys + item[:id].keys
82
- else
83
- acc + item.keys
84
- end
85
- end
86
- keys == [:id, :file, *@id_keys].to_set
78
+ def check_format(index)
79
+ cehck_basic_format(index) && check_id_format(index)
80
+ end
81
+
82
+ def cehck_basic_format(index)
83
+ keys = %i[file id]
84
+ index.none? { |item| item.keys.sort != keys }
85
+ end
86
+
87
+ def check_id_format(index)
88
+ return true if @id_keys.empty?
89
+
90
+ keys = index.reduce(Set.new) { |acc, item| acc + item[:id].keys }
91
+ keys == @id_keys.to_set
87
92
  end
88
93
 
89
94
  #
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Index
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.