pluck_all 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,7 @@ module Mongoid
47
47
  private
48
48
 
49
49
  def plucked_value_mapper(type, doc)
50
- Proc.new do |n|
50
+ proc do |n|
51
51
  values = [n, n =~ /\./ ? doc[n.partition('.')[0]] : doc[n]]
52
52
  case type
53
53
  when :array then values[1]
@@ -55,6 +55,7 @@ module Mongoid
55
55
  end
56
56
  end
57
57
  end
58
+
58
59
  def get_query_data(normalized_select)
59
60
  return (@view ? @view.projection(normalized_select) : query.dup.select(normalized_select))
60
61
  end
@@ -0,0 +1,8 @@
1
+ class ActiveRecord::Base
2
+ if !defined?(attribute_types) && defined?(column_types)
3
+ class << self
4
+ # column_types was changed to attribute_types in Rails 5
5
+ alias attribute_types column_types
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module ActiveRecord
2
+ [
3
+ *([Type::Value, Type::Integer, Type::Serialized] if defined?(Type::Value)),
4
+ *([Enum::EnumType] if defined?(Enum::EnumType)),
5
+ ].each do |s|
6
+ s.class_eval do
7
+ if !method_defined?(:deserialize) && method_defined?(:type_cast_from_database)
8
+ # deserialize was changed to type_cast_from_database in Rails 5
9
+ alias_method :deserialize, :type_cast_from_database
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
- module PluckAll
3
- VERSION = '2.0.3'
4
- end
1
+ # frozen_string_literal: true
2
+ module PluckAll
3
+ VERSION = '2.0.4'
4
+ end
@@ -4,32 +4,32 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'pluck_all/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "pluck_all"
7
+ spec.name = 'pluck_all'
8
8
  spec.version = PluckAll::VERSION
9
- spec.authors = ["khiav reoy"]
10
- spec.email = ["mrtmrt15xn@yahoo.com.tw"]
9
+ spec.authors = ['khiav reoy']
10
+ spec.email = ['mrtmrt15xn@yahoo.com.tw']
11
11
 
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
- spec.homepage = "https://github.com/khiav223577/pluck_all"
15
- spec.license = "MIT"
12
+ spec.summary = 'Pluck multiple columns/attributes and return array of hashes. Support Rails 3, 4, 5.'
13
+ spec.description = '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
+ spec.homepage = 'https://github.com/khiav223577/pluck_all'
15
+ spec.license = 'MIT'
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
18
  # delete this section to allow pushing this gem to any host.
19
- #if spec.respond_to?(:metadata)
19
+ # if spec.respond_to?(:metadata)
20
20
  # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- #else
21
+ # else
22
22
  # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- #end
23
+ # end
24
24
 
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
25
+ spec.files = `git ls-files -z`.split("\x0").reject{|f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency "activesupport", ">= 3.0.0"
30
+ spec.add_dependency 'activesupport', '>= 3.0.0'
31
31
 
32
- spec.add_development_dependency "bundler", "~> 1.11"
33
- spec.add_development_dependency "rake", "~> 12.0"
34
- spec.add_development_dependency "minitest", "~> 5.0"
32
+ spec.add_development_dependency 'bundler', '>= 1.17', '< 3.x'
33
+ spec.add_development_dependency 'rake', '~> 12.0'
34
+ spec.add_development_dependency 'minitest', '~> 5.0'
35
35
  end
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: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - khiav reoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2019-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ - - "<"
32
35
  - !ruby/object:Gem::Version
33
- version: '1.11'
36
+ version: 3.x
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '1.17'
44
+ - - "<"
39
45
  - !ruby/object:Gem::Version
40
- version: '1.11'
46
+ version: 3.x
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +83,7 @@ extensions: []
77
83
  extra_rdoc_files: []
78
84
  files:
79
85
  - ".gitignore"
86
+ - ".rubocop.yml"
80
87
  - ".travis.yml"
81
88
  - CHANGELOG.md
82
89
  - CODE_OF_CONDUCT.md
@@ -97,6 +104,8 @@ files:
97
104
  - lib/pluck_all/hooks.rb
98
105
  - lib/pluck_all/models/active_record_extension.rb
99
106
  - lib/pluck_all/models/mongoid_extension.rb
107
+ - lib/pluck_all/models/patches/attribute_types.rb
108
+ - lib/pluck_all/models/patches/deserialize.rb
100
109
  - lib/pluck_all/version.rb
101
110
  - pluck_all.gemspec
102
111
  homepage: https://github.com/khiav223577/pluck_all
@@ -119,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
128
  version: '0'
120
129
  requirements: []
121
130
  rubyforge_project:
122
- rubygems_version: 2.6.13
131
+ rubygems_version: 2.7.6
123
132
  signing_key:
124
133
  specification_version: 4
125
134
  summary: Pluck multiple columns/attributes and return array of hashes. Support Rails