active_house 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_house/collectable.rb +7 -2
- data/lib/active_house/version.rb +1 -1
- data/lib/active_house/whereable.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7200836f06d8f9970958725e34d7114396628bfc
|
4
|
+
data.tar.gz: 5af9fe43759f8bfec281614e90d1ddb77d03bbbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b52863ddcbb884f18cdaaccd9c48562f470c5a06fe6b66863cbe28befdfc009419159b559a22796044c3bc35cec6bcfe564c79dbed123bb982a8f6158cfc8c
|
7
|
+
data.tar.gz: 88331b558031b0e5f6b3418b666127c81ba7378216693c84b976885fc726301e8c5334efee9c0b3d63e681353600083cbfbbeb3ac5da16f3099a04ef9ccd1572
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/concern'
|
2
2
|
require 'active_support/core_ext/string/filters'
|
3
|
+
require 'active_support/core_ext/module/delegation'
|
3
4
|
|
4
5
|
module ActiveHouse
|
5
6
|
module Collectable
|
@@ -26,8 +27,6 @@ module ActiveHouse
|
|
26
27
|
connection.select_rows(to_query.squish)
|
27
28
|
end
|
28
29
|
|
29
|
-
private
|
30
|
-
|
31
30
|
def collection
|
32
31
|
@collection ||= fetch_collection
|
33
32
|
end
|
@@ -35,5 +34,11 @@ module ActiveHouse
|
|
35
34
|
def fetch_collection
|
36
35
|
to_hashes.map { |row| model_class.load!(row) }
|
37
36
|
end
|
37
|
+
|
38
|
+
included do
|
39
|
+
private :collection, :fetch_collection
|
40
|
+
delegate :each, :size, :count, :map, :collect, :detect, :filter, :reject, :inject, :reduce, :all?, :any?,
|
41
|
+
to: :to_a
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
data/lib/active_house/version.rb
CHANGED
@@ -46,5 +46,12 @@ module ActiveHouse
|
|
46
46
|
formatted_conditions = Array.wrap(format_condition(*conditions))
|
47
47
|
chain_query conditions: (@conditions + formatted_conditions).uniq
|
48
48
|
end
|
49
|
+
|
50
|
+
def where_not(*conditions)
|
51
|
+
raise ArgumentError, 'wrong number of arguments' if conditions.empty?
|
52
|
+
formatted_conditions = Array.wrap(format_condition(*conditions))
|
53
|
+
negative_condition = "NOT (#{formatted_conditions.join(' AND ')})"
|
54
|
+
chain_query conditions: (@conditions + [negative_condition]).uniq
|
55
|
+
end
|
49
56
|
end
|
50
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_house
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Talakevich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|