ensurance 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ensurance.rb +3 -3
- data/lib/ensurance/version.rb +1 -1
- metadata +1 -2
- data/file:memdb1?mode=memory&cache=shared +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01f514ba5f0eef829157408e664c9e5156b2058e
|
4
|
+
data.tar.gz: 491475ddd8df0c8fe9f6044015ec4bb08953f47a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771842cca4e6ca4ffb2801d62bef28dc494278f580e52131051e93bab6e55675453986c81c6b2ad8419cdf3485f5c98fcb248ad28a8ff222e522ab623c7fdcc1
|
7
|
+
data.tar.gz: a7868bd6816f1719de2cf547bc0584ed5eff89137eb089359dff8dd54bc096f9952598920e60d48a02f2b43b18dbb606a754b2c24efd1d7c8ca50d008d711b98
|
data/Gemfile.lock
CHANGED
data/lib/ensurance.rb
CHANGED
@@ -10,8 +10,8 @@ module Ensurance
|
|
10
10
|
|
11
11
|
class_methods do
|
12
12
|
def ensure_by(*args)
|
13
|
-
@
|
14
|
-
@_ensure_by
|
13
|
+
@_additional_ensure_by = args
|
14
|
+
@_ensure_by = nil
|
15
15
|
end
|
16
16
|
|
17
17
|
def ensure(thing = nil)
|
@@ -28,7 +28,7 @@ module Ensurance
|
|
28
28
|
end
|
29
29
|
found = nil
|
30
30
|
|
31
|
-
@_ensure_by ||= [
|
31
|
+
@_ensure_by ||= [self.primary_key, @_additional_ensure_by].flatten.compact.uniq
|
32
32
|
@_ensure_by.each do |ensure_field|
|
33
33
|
value = thing.try(:fetch, ensure_field.to_sym, nil) || thing.try(:fetch, ensure_field.to_s, nil) || thing
|
34
34
|
found = self.find_by(ensure_field => value)
|
data/lib/ensurance/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ensurance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sharpe
|
@@ -151,7 +151,6 @@ files:
|
|
151
151
|
- bin/setup
|
152
152
|
- ensurance-0.1.0.gem
|
153
153
|
- ensurance.gemspec
|
154
|
-
- file:memdb1?mode=memory&cache=shared
|
155
154
|
- lib/ensurance.rb
|
156
155
|
- lib/ensurance/date_ensure.rb
|
157
156
|
- lib/ensurance/hash_ensure.rb
|
Binary file
|