pluck_all 1.2.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +19 -12
- data/CHANGELOG.md +39 -0
- data/README.md +56 -6
- data/gemfiles/3.2.gemfile +2 -2
- data/gemfiles/4.2.gemfile +2 -2
- data/gemfiles/5.0.gemfile +2 -2
- data/gemfiles/5.1.gemfile +14 -0
- data/gemfiles/5.2.gemfile +14 -0
- data/lib/pluck_all.rb +30 -16
- data/lib/pluck_all/mongoid_pluck_all.rb +55 -0
- data/lib/pluck_all/version.rb +2 -1
- data/pluck_all.gemspec +3 -2
- metadata +27 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa1aa7d453681e40416df834c94c2b53a062ac7e8a6bf49274ea4b672ecbca42
|
4
|
+
data.tar.gz: 3c993741218094a58a85636ed87346164791ff4d041a0f0d8c9fb0cfbf3b158b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbec73a952c75b7d7dbdeb4ecc5f15ad4e83e4c22a7dc171cc92f1061798e00c35581d4d68f47aabcb889218bda0f1668c28dcbc8fc06969378e9c416cfec8b
|
7
|
+
data.tar.gz: 5063080302396865c965a5b3c187934c74097db57abb07ada6c80c2ca491faa6e1ef7c390234f9267677d813bc1dfc0af52505202095c9fcb9bb1bb265f2c65b
|
data/.travis.yml
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
+
sudo: false
|
2
|
+
env:
|
3
|
+
global:
|
4
|
+
- CC_TEST_REPORTER_ID=db72eba1ff8fb1329dae5fb9b9dcd234243899d7a464ceb374e14a05ead27b7c
|
1
5
|
language: ruby
|
2
6
|
rvm:
|
3
7
|
- 2.2
|
4
8
|
- 2.3
|
5
|
-
|
6
|
-
|
7
|
-
before_install:
|
8
|
-
- gem install bundler
|
9
|
-
- gem update --system
|
10
|
-
- gem --version
|
9
|
+
services:
|
10
|
+
- mongodb
|
11
11
|
gemfile:
|
12
12
|
- gemfiles/3.2.gemfile
|
13
13
|
- gemfiles/4.2.gemfile
|
14
14
|
- gemfiles/5.0.gemfile
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
-
|
20
|
-
|
15
|
+
- gemfiles/5.1.gemfile
|
16
|
+
- gemfiles/5.2.gemfile
|
17
|
+
before_install:
|
18
|
+
- gem install bundler
|
19
|
+
- gem update --system
|
20
|
+
- gem --version
|
21
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
22
|
+
- chmod +x ./cc-test-reporter
|
23
|
+
- ./cc-test-reporter before-build
|
24
|
+
script:
|
25
|
+
- bundle exec rake test
|
26
|
+
after_script:
|
27
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
## Change Log
|
2
|
+
|
3
|
+
### [upcoming](https://github.com/khiav223577/pluck_all/compare/v1.2.4...HEAD) 2018/04/05
|
4
|
+
- [#20](https://github.com/khiav223577/pluck_all/pull/20) test pluck_all in rails 5.1.x (@khiav223577)
|
5
|
+
- [#19](https://github.com/khiav223577/pluck_all/pull/19) add test cases to test `join` with table name and `alias` (@khiav223577)
|
6
|
+
|
7
|
+
### [v1.2.4](https://github.com/khiav223577/pluck_all/compare/v1.2.3...v1.2.4) 2017/04/11
|
8
|
+
- [#17](https://github.com/khiav223577/pluck_all/pull/17) supports carrierwave 1.0.0 (@khiav223577)
|
9
|
+
|
10
|
+
### [v1.2.3](https://github.com/khiav223577/pluck_all/compare/v1.2.2...v1.2.3) 2017/04/03
|
11
|
+
- [#14](https://github.com/khiav223577/pluck_all/pull/14) use mass assign to assign values (@khiav223577)
|
12
|
+
- [#16](https://github.com/khiav223577/pluck_all/pull/16) Checking if Class has CarrierWave loaded (@basex)
|
13
|
+
- [#15](https://github.com/khiav223577/pluck_all/pull/15) Restrict dependency to activerecord (@basex)
|
14
|
+
|
15
|
+
### [v1.2.2](https://github.com/khiav223577/pluck_all/compare/v1.2.1...v1.2.2) 2017/03/14
|
16
|
+
- [#13](https://github.com/khiav223577/pluck_all/pull/13) Model.none.pluck_all(..) should return empty array instead of raising exception (@khiav223577)
|
17
|
+
- [#12](https://github.com/khiav223577/pluck_all/pull/12) test other ruby version (@khiav223577)
|
18
|
+
|
19
|
+
### [v1.2.1](https://github.com/khiav223577/pluck_all/compare/v1.2.0...v1.2.1) 2017/01/24
|
20
|
+
- [#11](https://github.com/khiav223577/pluck_all/pull/11) always return carrierwave uploader if possible (@khiav223577)
|
21
|
+
- [#10](https://github.com/khiav223577/pluck_all/pull/10) change pluck_all return value of carrierwave column (@khiav223577)
|
22
|
+
|
23
|
+
### [v1.2.0](https://github.com/khiav223577/pluck_all/compare/v1.1.2...v1.2.0) 2017/01/24
|
24
|
+
- [#5](https://github.com/khiav223577/pluck_all/pull/5) Support casting CarrierWave url (@khiav223577)
|
25
|
+
- [#9](https://github.com/khiav223577/pluck_all/pull/9) need ActiveRecord version not Rails version (@khiav223577)
|
26
|
+
- [#8](https://github.com/khiav223577/pluck_all/pull/8) Upgrade rake version in development (@khiav223577)
|
27
|
+
|
28
|
+
### [v1.1.2](https://github.com/khiav223577/pluck_all/compare/v1.1.1...v1.1.2) 2017/01/06
|
29
|
+
- [#7](https://github.com/khiav223577/pluck_all/pull/7) fix pluck_all with join (@khiav223577)
|
30
|
+
|
31
|
+
### [v1.1.1](https://github.com/khiav223577/pluck_all/compare/v1.1.0...v1.1.1) 2017/01/01
|
32
|
+
- [#4](https://github.com/khiav223577/pluck_all/pull/4) add code climate (@khiav223577)
|
33
|
+
|
34
|
+
### [v1.1.0](https://github.com/khiav223577/pluck_all/compare/v1.0.1...v1.1.0) 2016/12/21
|
35
|
+
- [#3](https://github.com/khiav223577/pluck_all/pull/3) Feature/pluck array (@khiav223577)
|
36
|
+
|
37
|
+
### v1.0.1 2016/12/20
|
38
|
+
- [#2](https://github.com/khiav223577/pluck_all/pull/2) test with multiple rails version (@khiav223577)
|
39
|
+
- [#1](https://github.com/khiav223577/pluck_all/pull/1) add basic test cases (@khiav223577)
|
data/README.md
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
|
9
9
|
Pluck multiple columns/attributes in Rails 3, 4, 5, and can return data as hash instead of only array.
|
10
10
|
|
11
|
-
This Gem
|
12
|
-
And
|
11
|
+
This Gem stands on the shoulders of this article: [Plucking Multiple Columns in Rails 3](http://meltingice.net/2013/06/11/pluck-multiple-columns-rails/).
|
12
|
+
And modified to support not only Rail 3.
|
13
13
|
|
14
|
-
If you have a Rails 3 project, and want to pluck not only one column,
|
14
|
+
If you have a Rails 3 project, and want to pluck not only one column,
|
15
15
|
feel free to use this gem and no need to worry about upgrading to Rails 4, 5 in the future will break this.
|
16
16
|
|
17
17
|
|
@@ -33,22 +33,72 @@ Or install it yourself as:
|
|
33
33
|
$ gem install pluck_all
|
34
34
|
|
35
35
|
## Usage
|
36
|
+
|
36
37
|
### pluck to array
|
38
|
+
|
37
39
|
Behaves the same as the Rails 4 pluck, but you can use it in Rails 3
|
40
|
+
|
38
41
|
```rb
|
39
42
|
User.where('id < 3').pluck_array(:id, :account)
|
40
43
|
# => [[1, 'account1'], [2, 'account2']]
|
41
44
|
```
|
45
|
+
|
42
46
|
### pluck to hash
|
47
|
+
|
43
48
|
Similar to `pluck_array`, but return hash instead.
|
49
|
+
|
44
50
|
```rb
|
45
51
|
User.where('id < 3').pluck_all(:id, :account)
|
46
|
-
# => [{"id"=>1, "account"=>"account1"}, {"id"=>2, "account"=>"account2"}]
|
52
|
+
# => [{"id"=>1, "account"=>"account1"}, {"id"=>2, "account"=>"account2"}]
|
47
53
|
|
48
54
|
User.where('id < 3').pluck_all('id, account AS name')
|
49
|
-
# => [{"id"=>1, "name"=>"account1"}, {"id"=>2, "name"=>"account2"}]
|
55
|
+
# => [{"id"=>1, "name"=>"account1"}, {"id"=>2, "name"=>"account2"}]
|
56
|
+
```
|
57
|
+
|
58
|
+
## Support Mongoid
|
59
|
+
```rb
|
60
|
+
class User
|
61
|
+
include Mongoid::Document
|
62
|
+
|
63
|
+
field :name, type: String
|
64
|
+
field :age, type: Integer
|
65
|
+
end
|
66
|
+
|
67
|
+
User.pluck_all(:name, :age)
|
68
|
+
# => [
|
69
|
+
# {'name' => 'Pearl Shi' , 'age' => 18},
|
70
|
+
# {'name' => 'Rumble Huang', 'age' => 20},
|
71
|
+
# {'name' => 'Khiav Reoy' , 'age' => 20},
|
72
|
+
# ]
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
## Benchmark
|
77
|
+
### Compare with `map` and `as_json`
|
78
|
+
|
79
|
+
`pluck_all` return raw `hash` data without loading a bunch of records, in that having better performace than using `map` and `as_json`. The following is the benchmark test on 191,093 users, where `users` table have 51 columns.
|
80
|
+
|
81
|
+
```rb
|
82
|
+
user system total real
|
83
|
+
map 36.110000 61.200000 97.310000 ( 99.535375)
|
84
|
+
select + map 10.530000 0.660000 11.190000 ( 12.550974)
|
85
|
+
select + as_json 49.040000 1.120000 50.160000 ( 55.417534)
|
86
|
+
pluck_all 3.310000 0.100000 3.410000 ( 3.527775)
|
87
|
+
```
|
88
|
+
[test script](https://github.com/khiav223577/pluck_all/issues/18)
|
89
|
+
|
90
|
+
### Compare with [pluck_to_hash](https://github.com/girishso/pluck_to_hash) gem
|
91
|
+
|
92
|
+
`pluck_all` has better performace since it uses raw `hash` data from `ActiveRecord::Base.connection.select_all`, while `pluck_to_hash` uses `pluck` method, which calls `ActiveRecord::Base.connection.select_all` and transfers the raw `hash` data to `array` format, and then transfer the data to `hash` format again. The following benchmark test uses same datebase as above.
|
93
|
+
|
94
|
+
```rb
|
95
|
+
user system total real
|
96
|
+
pluck_to_hash 2.960000 0.130000 3.090000 ( 3.421640)
|
97
|
+
pluck_all 2.160000 0.120000 2.280000 ( 2.605118)
|
50
98
|
```
|
99
|
+
[test script](https://github.com/khiav223577/pluck_all/issues/18#issuecomment-325407080)
|
51
100
|
|
101
|
+
## Other Support
|
52
102
|
### Support Pluck Carrierwave Uploader (if you use carrierwave)
|
53
103
|
```rb
|
54
104
|
User.where(xxx).pluck_all(:profile_pic).map{|s| s['profile_pic'] }
|
@@ -58,7 +108,7 @@ is the same as
|
|
58
108
|
User.where(xxx).map(&:profile_pic)
|
59
109
|
```
|
60
110
|
If the uploader use something like: `model.id`, `model.name`
|
61
|
-
You
|
111
|
+
You may have to send these columns manually:
|
62
112
|
```rb
|
63
113
|
User.where(xxx).cast_need_columns(%i(id, name)).pluck_all(:id, :name, :profile_pic).map{|s| s['profile_pic'] }
|
64
114
|
```
|
data/gemfiles/3.2.gemfile
CHANGED
@@ -2,11 +2,11 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in pluck_all.gemspec
|
4
4
|
|
5
|
-
gem "activerecord", "~> 3.2"
|
5
|
+
gem "activerecord", "~> 3.2.0"
|
6
6
|
|
7
7
|
group :test do
|
8
8
|
gem "simplecov"
|
9
|
-
gem
|
9
|
+
gem 'mongoid', '~> 3.1.7'
|
10
10
|
gem 'carrierwave', '~> 0.11.0'
|
11
11
|
end
|
12
12
|
|
data/gemfiles/4.2.gemfile
CHANGED
@@ -2,11 +2,11 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in pluck_all.gemspec
|
4
4
|
|
5
|
-
gem "activerecord", "~> 4.2"
|
5
|
+
gem "activerecord", "~> 4.2.0"
|
6
6
|
|
7
7
|
group :test do
|
8
8
|
gem "simplecov"
|
9
|
-
gem
|
9
|
+
gem 'mongoid', '~> 5.4.0'
|
10
10
|
gem 'carrierwave', '~> 0.11.0'
|
11
11
|
end
|
12
12
|
|
data/gemfiles/5.0.gemfile
CHANGED
@@ -2,11 +2,11 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in pluck_all.gemspec
|
4
4
|
|
5
|
-
gem "activerecord", "~> 5.0"
|
5
|
+
gem "activerecord", "~> 5.0.0"
|
6
6
|
|
7
7
|
group :test do
|
8
8
|
gem "simplecov"
|
9
|
-
gem
|
9
|
+
gem 'mongoid', '~> 6.0.3'
|
10
10
|
gem 'carrierwave', '~> 0.11.0'
|
11
11
|
end
|
12
12
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in pluck_all.gemspec
|
4
|
+
|
5
|
+
gem "activerecord", "~> 5.1.0"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem "simplecov"
|
9
|
+
gem 'mongoid', '~> 7.0.1'
|
10
|
+
gem 'carrierwave', '~> 0.11.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
gemspec :path => "../"
|
14
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in pluck_all.gemspec
|
4
|
+
|
5
|
+
gem "activerecord", "~> 5.2.0"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem "simplecov"
|
9
|
+
gem 'mongoid', '~> 7.0.1'
|
10
|
+
gem 'carrierwave', '~> 0.11.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
gemspec :path => "../"
|
14
|
+
|
data/lib/pluck_all.rb
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'pluck_all/version'
|
2
3
|
require 'active_record'
|
4
|
+
begin
|
5
|
+
require 'mongoid'
|
6
|
+
require 'pluck_all/mongoid_pluck_all'
|
7
|
+
rescue Gem::LoadError
|
8
|
+
end
|
3
9
|
|
4
10
|
class ActiveRecord::Base
|
5
11
|
if !defined?(attribute_types) && defined?(column_types)
|
6
12
|
class << self
|
7
|
-
#Rails 5
|
13
|
+
# column_types was changed to attribute_types in Rails 5
|
8
14
|
alias_method :attribute_types, :column_types
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
18
|
+
|
12
19
|
module ActiveRecord
|
13
20
|
[
|
14
21
|
*([Type::Value, Type::Integer, Type::Serialized] if defined?(Type::Value)),
|
@@ -16,17 +23,18 @@ module ActiveRecord
|
|
16
23
|
].each do |s|
|
17
24
|
s.class_eval do
|
18
25
|
if !method_defined?(:deserialize) && method_defined?(:type_cast_from_database)
|
19
|
-
#
|
26
|
+
# column_types was changed to attribute_types in Rails 5
|
20
27
|
alias deserialize type_cast_from_database
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
24
31
|
end
|
32
|
+
|
25
33
|
class ActiveRecord::Relation
|
26
34
|
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
|
27
35
|
def pluck_all(*args)
|
28
36
|
result = select_all(*args)
|
29
|
-
result.map! do |attributes| #This map! behaves different to array#map!
|
37
|
+
result.map! do |attributes| # This map! behaves different to array#map!
|
30
38
|
initialized_attributes = klass.initialize_attributes(attributes)
|
31
39
|
attributes.each do |key, attribute|
|
32
40
|
attributes[key] = klass.type_cast_attribute(key, initialized_attributes) #TODO 現在AS過後的type cast會有一點問題
|
@@ -38,7 +46,7 @@ class ActiveRecord::Relation
|
|
38
46
|
def pluck_all(*args)
|
39
47
|
result = select_all(*args)
|
40
48
|
attribute_types = klass.attribute_types
|
41
|
-
result.map! do |attributes| #This map! behaves different to array#map!
|
49
|
+
result.map! do |attributes| # This map! behaves different to array#map!
|
42
50
|
attributes.each do |key, attribute|
|
43
51
|
attributes[key] = result.send(:column_type, key, attribute_types).deserialize(attribute) #TODO 現在AS過後的type cast會有一點問題,但似乎原生的pluck也有此問題
|
44
52
|
end
|
@@ -46,12 +54,15 @@ class ActiveRecord::Relation
|
|
46
54
|
end
|
47
55
|
end
|
48
56
|
end
|
57
|
+
|
49
58
|
def cast_need_columns(column_names, _klass = nil)
|
50
59
|
@pluck_all_cast_need_columns = column_names.map(&:to_s)
|
51
60
|
@pluck_all_cast_klass = _klass
|
52
61
|
return self
|
53
62
|
end
|
54
|
-
|
63
|
+
|
64
|
+
private
|
65
|
+
|
55
66
|
def select_all(*args)
|
56
67
|
args.map! do |column_name|
|
57
68
|
if column_name.is_a?(Symbol) && column_names.include?(column_name.to_s)
|
@@ -64,9 +75,10 @@ private
|
|
64
75
|
return klass.connection.select_all(relation.select(args).to_sql)
|
65
76
|
#return klass.connection.select_all(relation.arel)
|
66
77
|
end
|
67
|
-
|
68
|
-
#
|
69
|
-
|
78
|
+
|
79
|
+
# ----------------------------------------------------------------
|
80
|
+
# ● Support casting CarrierWave url
|
81
|
+
# ----------------------------------------------------------------
|
70
82
|
def cast_carrier_wave_uploader_url(attributes)
|
71
83
|
if defined?(CarrierWave) && klass.respond_to?(:uploaders)
|
72
84
|
@pluck_all_cast_klass ||= klass
|
@@ -98,15 +110,17 @@ class ActiveRecord::Relation
|
|
98
110
|
end
|
99
111
|
|
100
112
|
|
101
|
-
class ActiveRecord::Base
|
102
|
-
def
|
103
|
-
|
113
|
+
class << ActiveRecord::Base
|
114
|
+
def cast_need_columns(*args)
|
115
|
+
where(nil).cast_need_columns(*args)
|
104
116
|
end
|
105
|
-
|
106
|
-
|
117
|
+
|
118
|
+
def pluck_all(*args)
|
119
|
+
where(nil).pluck_all(*args)
|
107
120
|
end
|
108
|
-
|
109
|
-
|
121
|
+
|
122
|
+
def pluck_array(*args)
|
123
|
+
where(nil).pluck_array(*args)
|
110
124
|
end
|
111
125
|
end
|
112
126
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Mongoid
|
3
|
+
module Findable
|
4
|
+
delegate :pluck_all, :pluck_array, to: :with_default_scope
|
5
|
+
end
|
6
|
+
|
7
|
+
module Contextual
|
8
|
+
delegate :pluck_all, :pluck_array, to: :context
|
9
|
+
|
10
|
+
class None
|
11
|
+
def pluck_array(*)
|
12
|
+
[]
|
13
|
+
end
|
14
|
+
|
15
|
+
def pluck_all(*)
|
16
|
+
[]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Mongo
|
21
|
+
def pluck_array(*fields)
|
22
|
+
normalized_select = get_normalized_select(fields)
|
23
|
+
get_query_data(normalized_select).reduce([]) do |plucked, doc|
|
24
|
+
values = normalized_select.keys.map do |n|
|
25
|
+
n =~ /\./ ? doc[n.partition('.')[0]] : doc[n]
|
26
|
+
end
|
27
|
+
plucked << (values.size == 1 ? values.first : values)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def pluck_all(*fields)
|
32
|
+
normalized_select = get_normalized_select(fields)
|
33
|
+
get_query_data(normalized_select).reduce([]) do |plucked, doc|
|
34
|
+
values = normalized_select.keys.map do |n|
|
35
|
+
[n, n =~ /\./ ? doc[n.partition('.')[0]] : doc[n]]
|
36
|
+
end.to_h
|
37
|
+
plucked << values
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def get_query_data(normalized_select)
|
44
|
+
return (@view ? @view.projection(normalized_select) : query.dup.select(normalized_select))
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_normalized_select(fields)
|
48
|
+
normalized_select = fields.inject({}) do |hash, f|
|
49
|
+
hash[klass.database_field_name(f)] = 1
|
50
|
+
hash
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/pluck_all/version.rb
CHANGED
data/pluck_all.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["khiav reoy"]
|
10
10
|
spec.email = ["mrtmrt15xn@yahoo.com.tw"]
|
11
11
|
|
12
|
-
spec.summary = %q{Pluck multiple columns/attributes
|
13
|
-
spec.description = %q{Pluck multiple columns/attributes
|
12
|
+
spec.summary = %q{Pluck multiple columns/attributes and return array of hashes. Support Rails 3, 4, 5.}
|
13
|
+
spec.description = %q{Pluck multiple columns/attributes and return array of hashes. Support Rails 3, 4, 5. If you have a Rails 3 project, and want to pluck not only one column, feel free to use this gem and no need to worry about upgrading to Rails 4, 5 in the future will break this.}
|
14
14
|
spec.homepage = "https://github.com/khiav223577/pluck_all"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "rake", "~> 12.0"
|
32
32
|
spec.add_development_dependency "sqlite3", "~> 1.3"
|
33
33
|
spec.add_development_dependency "minitest", "~> 5.0"
|
34
|
+
spec.add_development_dependency "mongoid", ">= 3.1.7"
|
34
35
|
|
35
36
|
spec.add_dependency "activerecord", ">= 3"
|
36
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluck_all
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mongoid
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.7
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.7
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: activerecord
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,10 +94,10 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '3'
|
83
|
-
description: Pluck multiple columns/attributes
|
84
|
-
|
85
|
-
|
86
|
-
|
97
|
+
description: Pluck multiple columns/attributes and return array of hashes. Support
|
98
|
+
Rails 3, 4, 5. If you have a Rails 3 project, and want to pluck not only one column,
|
99
|
+
feel free to use this gem and no need to worry about upgrading to Rails 4, 5 in
|
100
|
+
the future will break this.
|
87
101
|
email:
|
88
102
|
- mrtmrt15xn@yahoo.com.tw
|
89
103
|
executables: []
|
@@ -92,6 +106,7 @@ extra_rdoc_files: []
|
|
92
106
|
files:
|
93
107
|
- ".gitignore"
|
94
108
|
- ".travis.yml"
|
109
|
+
- CHANGELOG.md
|
95
110
|
- CODE_OF_CONDUCT.md
|
96
111
|
- LICENSE.txt
|
97
112
|
- README.md
|
@@ -101,7 +116,10 @@ files:
|
|
101
116
|
- gemfiles/3.2.gemfile
|
102
117
|
- gemfiles/4.2.gemfile
|
103
118
|
- gemfiles/5.0.gemfile
|
119
|
+
- gemfiles/5.1.gemfile
|
120
|
+
- gemfiles/5.2.gemfile
|
104
121
|
- lib/pluck_all.rb
|
122
|
+
- lib/pluck_all/mongoid_pluck_all.rb
|
105
123
|
- lib/pluck_all/version.rb
|
106
124
|
- pluck_all.gemspec
|
107
125
|
homepage: https://github.com/khiav223577/pluck_all
|
@@ -124,9 +142,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
142
|
version: '0'
|
125
143
|
requirements: []
|
126
144
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.6
|
145
|
+
rubygems_version: 2.7.6
|
128
146
|
signing_key:
|
129
147
|
specification_version: 4
|
130
|
-
summary: Pluck multiple columns/attributes
|
131
|
-
|
148
|
+
summary: Pluck multiple columns/attributes and return array of hashes. Support Rails
|
149
|
+
3, 4, 5.
|
132
150
|
test_files: []
|