sql_pluck 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sql_pluck.rb +2 -15
  3. data/sql_pluck.gemspec +2 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9f5086d4cb495cb7c516e7163fb066f22123cdd223e6a7b6443c722a0ef2785
4
- data.tar.gz: 8efe9c3b4ebad21a60ed99ccd08b241bdeaced31e189871049d0fe1d09aa0904
3
+ metadata.gz: e593575f7b2b7f0b1c48be492893a4d3d5f187c3432f65d3e2823630fc2bb22b
4
+ data.tar.gz: 8b866881c4072ed6770773cb50489f0aaf159fd1a96d969cd4b8b1a59ffd1bd1
5
5
  SHA512:
6
- metadata.gz: 47b031b25c4502ccb3ce3fff20b2db3d248828d7743c1e542ff1ae71b9201eba1cfcc6664710890b0bd8dae51a1bc9945e8aaced86a9ff989c6f7f96253b4a14
7
- data.tar.gz: 48b6df878922ec6ff1fa91e35eb3aad88e4a2412839fda6552ec4e450475fe8cae17f60ac5212333694b8735800120e6033606fb7ac85fba9be635333ea6b904
6
+ metadata.gz: f731a4b70ded526a4d038c61baa86760d1f161e52e831e72e05bf1cbcec5152e69209ce757b41f8a87766225103b409c2c956361e8f5e1d0527e22bd7d662d15
7
+ data.tar.gz: e07327f6d7e1ddb63e2cebcd87fcff97e56b222bb40cd66fa44f60f3ea81fed35c99c8c7c108a6ed02000f7ebcde2bc7bee68eaf20ed395d2d0cef1df84cd11c
@@ -14,20 +14,7 @@ module SQLPluck
14
14
  # like .pluck method.
15
15
  #
16
16
  def pluck_by_sql(sql, binds = [])
17
- rs = connection.select_all(sanitize_sql(sql), "#{name} Load", binds)
18
- types = rs.column_types
19
- rs.map {|record| cast_record(record, types) }
20
- end
21
-
22
- private
23
-
24
- def cast_record(record, types)
25
- record.map {|name, string| types[name].type_cast(string) }
26
- end
27
- end
28
-
29
- if defined?(ActiveRecord::Type)
30
- class ActiveRecord::Type::Value # reopen
31
- public :type_cast
17
+ result = connection.select_all(sanitize_sql(sql), "#{name} Load", binds)
18
+ result.cast_values(result.column_types)
32
19
  end
33
20
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = 'sql_pluck'
4
- s.version = '1.0.0'
4
+ s.version = '2.0.0'
5
5
  s.summary = 'Provide #pluck_by_sql for Rails ActiveRecord models'
6
6
  s.license = 'MIT'
7
7
 
@@ -12,5 +12,5 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
13
13
  s.require_path = 'lib'
14
14
 
15
- s.add_dependency 'activerecord', '~> 4.0'
15
+ s.add_dependency 'activerecord', '~> 5.0'
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql_pluck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '5.0'
27
27
  description:
28
28
  email: aamine@loveruby.net
29
29
  executables: []