poros 0.3.0 → 0.3.1
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 +4 -4
- data/lib/poros/class_methods.rb +8 -3
- data/lib/poros/instance_methods.rb +1 -1
- data/lib/poros/version.rb +1 -1
- data/poros.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 016c361abb81a9dfe8c7a338515754ded79a4fd70518ed23964765ec098bc5e5
|
4
|
+
data.tar.gz: 50679f5bdc6b51afb5e612aa7c93d9de67b469a05ad1baf971d694a5d157e478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 397fa97afdc11207acb52d695988bf8045b46dc84d37c938649625e50e8555893b03d755487615aaeb291cb0a2dc7b59ac4ca17629f3b42602f481023a01d815
|
7
|
+
data.tar.gz: 69a8f43db77401244d12ca66cb0a0d8f527309c335b0e38b6e41347764c8569942b9ffe662f96581dd1ae28b1b97d2dd73cc7b72ec5016ff97b8bf736beb5874
|
data/lib/poros/class_methods.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module Poros
|
2
4
|
module ClassMethods
|
3
5
|
attr_accessor :in_transaction, :data_changed
|
@@ -61,7 +63,7 @@ module Poros
|
|
61
63
|
end
|
62
64
|
|
63
65
|
def index_data
|
64
|
-
return @index_data if @index_data
|
66
|
+
return @index_data if defined? @index_data
|
65
67
|
|
66
68
|
data = File.exist?(index_file) ? YAML.load(File.read(index_file)) : {}
|
67
69
|
# Make sure we always have every index as a key
|
@@ -73,6 +75,7 @@ module Poros
|
|
73
75
|
end
|
74
76
|
|
75
77
|
def write_index_data
|
78
|
+
return if in_transaction
|
76
79
|
File.write(index_file, @index_data.to_yaml)
|
77
80
|
end
|
78
81
|
|
@@ -88,20 +91,22 @@ module Poros
|
|
88
91
|
@index_data[index][value] = @index_data[index][value] | [object.uuid]
|
89
92
|
end
|
90
93
|
|
91
|
-
write_index_data
|
94
|
+
write_index_data
|
92
95
|
end
|
93
96
|
|
94
97
|
def remove_from_index(object, perist = true)
|
95
98
|
index_data
|
99
|
+
@data_changed = true
|
96
100
|
|
97
101
|
poro_indexes.each do |index|
|
98
102
|
@index_data[index] = {} unless @index_data.has_key?(index)
|
99
103
|
@index_data[index].keys.each do |value|
|
100
104
|
@index_data[index][value] ||= []
|
101
105
|
@index_data[index][value] -= [object.uuid]
|
106
|
+
@index_data[index].delete(value) if @index_data[index][value] == []
|
102
107
|
end
|
103
108
|
end
|
104
|
-
write_index_data if
|
109
|
+
write_index_data if perist
|
105
110
|
end
|
106
111
|
|
107
112
|
def rebuild_indexes
|
data/lib/poros/version.rb
CHANGED
data/poros.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = 'Persist your objects and query them in an active record like way'
|
12
12
|
spec.authors = ["Sean Ross Earle"]
|
13
13
|
spec.email = ["sean.earle@oeQuacki.com"]
|
14
|
-
spec.homepage = "https://github.com/HellRok/
|
14
|
+
spec.homepage = "https://github.com/HellRok/Poros"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Ross Earle
|
@@ -73,7 +73,7 @@ files:
|
|
73
73
|
- lib/poros/relations.rb
|
74
74
|
- lib/poros/version.rb
|
75
75
|
- poros.gemspec
|
76
|
-
homepage: https://github.com/HellRok/
|
76
|
+
homepage: https://github.com/HellRok/Poros
|
77
77
|
licenses:
|
78
78
|
- MIT
|
79
79
|
metadata: {}
|