active_house 0.5.1 → 0.6.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: 2d60547649c4e0311e6ccc92d5e6ea5c75e71d35
4
- data.tar.gz: b6d43bcbdab693c3da2c1bd1eb1b12c7853bdbf6
3
+ metadata.gz: 18ed7462f45a3c4c20e190c742688c9a8ec6e0f4
4
+ data.tar.gz: d096f13e19a63f47f3f65bf140fc77ec5fda2de2
5
5
  SHA512:
6
- metadata.gz: 7542b7fcd7e6ec3d77a9e28558c7d4949a422e9a519c85c714ed7cd8db82f518e42a78ece6edbf6ae56a033c388678503346f946f42e4bde65aede08d68beb3e
7
- data.tar.gz: 62486d802d065a5ac9c087de59956c85f05eca80f01e217c2be2c81b817d9cf2cb82349b64999b51ac4fb6d1eaf5f050de47f2fe7ea8a9f5a6cbe32f44ee27cb
6
+ metadata.gz: ee3e82a8e3cae6756b103ee3c2cd75cf482abbb0d372cd59690af07dd9e90093a743f3736608b1f03578830b870413358e77302f804339919eabe223652c81f8
7
+ data.tar.gz: 98dc615c0770051b73692782a2305e3b4236f74127c909cee9e0a03b1a59fc3509d8e48e9fc2eca7ada2dee0071ec74a8d53257bbab9f2c8ab2bba6ab53a94de
@@ -87,9 +87,19 @@ module ActiveHouse
87
87
  values[:group_by].empty? ? nil : values[:group_by]
88
88
  end
89
89
 
90
+ def pluck(*fields)
91
+ result = except(:select).select(*fields).to_hashes
92
+ return [] if result.empty?
93
+ if result.first.keys.size == 1
94
+ result.map { |row| row.values.first }
95
+ else
96
+ result.map(&:values)
97
+ end
98
+ end
99
+
90
100
  def count(value = 'COUNT() AS cnt')
91
101
  return 0 if group_values
92
- except(:select, :limit, :offset, :order).select(value).to_hashes.first.values.first
102
+ except(:select, :limit, :offset, :order).pluck(value).first
93
103
  end
94
104
 
95
105
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveHouse
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_house
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich