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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc2449d88714c2f34b57733a92422b1a02183dd2
4
- data.tar.gz: c19e751a4f47285f91219b33d4c5609a0984ed1a
3
+ metadata.gz: 7200836f06d8f9970958725e34d7114396628bfc
4
+ data.tar.gz: 5af9fe43759f8bfec281614e90d1ddb77d03bbbe
5
5
  SHA512:
6
- metadata.gz: 0cd75e2a09620840f0f7c3c14310ac36092896660ed218945780eccd9f185c9c2e1c94affa45d858e5fa27b62a27844a497fe717f29da0c4310d51dd3e9b2f31
7
- data.tar.gz: 96c15037a3802c88e2fccccc4057b05956fc8af1444d600f5007dd6cb1993622ad6457077704e6a0ac3520f0ce0c143b82bea837e59e51296aa8b1c41f18a916
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
@@ -1,3 +1,3 @@
1
1
  module ActiveHouse
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -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.3.2
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-01 00:00:00.000000000 Z
11
+ date: 2019-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel