poros 0.1.0 → 0.2.0

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: 3c1887d3665a8d34d90f44b16382afdd2863180aa1bbfdb3f065c2f417ad55e7
4
- data.tar.gz: b80355221534570d2a2f78c98d4cb26397176c04967e618cd496a95e967c77fd
3
+ metadata.gz: ae72d23c993aa92ac6dddd554b07d75019e914a1e0edc703de4fd6259712a1f3
4
+ data.tar.gz: 9168cac5343f7c9ca7c49dc8dbc9d5d926b15912e26175b75dc09a235932952a
5
5
  SHA512:
6
- metadata.gz: b8293c3a1e811aeef5df450149e4d8e2f7735b6f222ae0aa9e29efc5f136421adb42697c2b41d975abb563dc25e21ce9ce7a53bea319f703f1799207fe8c263c
7
- data.tar.gz: d48e5df3094177dc7ca4bf4e0fde76bd7ed860da99acb4f9d19b5081cebed97d478ce4a8fd0a6959d886dfcceb03c4c4872a96565dd8ffb7bb3d01e3418534b8
6
+ metadata.gz: cc3136fe7ad7558e3a4c06b30c2a964a35270c1fc6da66c8720eda6e224b74b339d8f1cbfa8a9ba6f47cd081085869e6d75f009fb00ca4a478982ec96ab7698b
7
+ data.tar.gz: c4635bb7871ea244cd378d06e111f5a509bcd82434f56635bfc8da071b8be2a5816191e96eb8e491d3cd9580441b4c28953fa0d24b86fc46acf774c49fa00f1b
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  Gemfile.lock
2
2
  /tmp/
3
+ /pkg/
data/lib/poros/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Poros
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/poros.rb CHANGED
@@ -112,6 +112,12 @@ module Poros
112
112
  index_data[key].keys.flat_map { |value_name|
113
113
  index_data[key][value_name] if value =~ value_name
114
114
  }.compact
115
+ when Array
116
+ value.flat_map { |value_name| index_data[key][value_name] }
117
+ when Proc
118
+ index_data[key].keys.flat_map { |value_name|
119
+ index_data[key][value_name] if value.call(value_name)
120
+ }.compact
115
121
  else
116
122
  index_data[key].has_key?(value) ?
117
123
  index_data[key][value] : []
@@ -120,11 +126,16 @@ module Poros
120
126
 
121
127
  if table_scan.size > 0
122
128
  scanned_results = Dir.glob(File.join(data_directory, '*.yml')).map { |file|
129
+ next if file == index_file
123
130
  data = YAML.load(File.read(file))
124
131
  data[:uuid] if table_scan.all? { |key, value|
125
132
  case value
126
133
  when Regexp
127
134
  value =~ data[key]
135
+ when Array
136
+ value.include?(data[key])
137
+ when Proc
138
+ value.call(data[key])
128
139
  else
129
140
  data[key] == value
130
141
  end
@@ -187,6 +198,15 @@ module Poros
187
198
  write_index_data if !@in_transaction && perist
188
199
  end
189
200
 
201
+ def rebuild_indexes
202
+ transaction do
203
+ @data_changed = true
204
+ @index_data = {}
205
+ File.delete(index_file) if File.exist?(index_file)
206
+ all.each { |object| update_index(object) }
207
+ end
208
+ end
209
+
190
210
  def transaction(&block)
191
211
  @in_transaction = true
192
212
  @data_changed = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poros
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Ross Earle