wharel 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/lib/wharel.rb +4 -2
- data/lib/wharel/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88276994d910f1ad92e85cba73bd2af743e8a6c9f248cd77cbd0ebe65050a2ac
|
4
|
+
data.tar.gz: f5b28c448a8f80166f9448d7e1004256f9a1fbe4ec4e52decbc7c653df51c60d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2850a9007cdd84e67c25093139eb101946c1c43c6bdce4afb8b16366bee4d3ec9a618e2be41f951fb5e098676f0e3d6effbd69982bb686bfd38d4bca78515073
|
7
|
+
data.tar.gz: 5ea4564b5db3dc12cb5aee1d1d5a6ce4510e0a705787c0ac2cd5464153700de3e67d22db5d36b40768fed1d83c5588d1b7b026810749102ee5b19642cc600a1b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ post](https://dejimata.com/2018/5/30/arel-with-wharel).
|
|
28
28
|
Add this line to your application's Gemfile:
|
29
29
|
|
30
30
|
```ruby
|
31
|
-
gem 'wharel', '~> 0.
|
31
|
+
gem 'wharel', '~> 0.5.0'
|
32
32
|
```
|
33
33
|
|
34
34
|
And then execute:
|
@@ -82,7 +82,7 @@ Post.where.not { title.eq("foo") }
|
|
82
82
|
Post.order { title.lower }
|
83
83
|
```
|
84
84
|
|
85
|
-
Wharel also supports `having`, `pluck`, `group` and `or` in the same way.
|
85
|
+
Wharel also supports `select`, `having`, `pluck`, `pick`, `group` and `or` in the same way.
|
86
86
|
|
87
87
|
Now suppose we have another model `Comment` with a column `content`, and a
|
88
88
|
`Post` `has_many :comments`:
|
data/lib/wharel.rb
CHANGED
@@ -3,10 +3,12 @@ require "active_record"
|
|
3
3
|
|
4
4
|
module Wharel
|
5
5
|
module QueryMethods
|
6
|
-
%w[where order having pluck group].each do |method_name|
|
6
|
+
%w[select where order having pluck pick group].each do |method_name|
|
7
|
+
next unless ::ActiveRecord::Base.singleton_class.method_defined?(method_name)
|
8
|
+
|
7
9
|
module_eval <<-EOM, __FILE__, __LINE__ + 1
|
8
10
|
def #{method_name}(*, &block)
|
9
|
-
block_given? ? super(VirtualRow.build_query(self, &block)) : super
|
11
|
+
block_given? ? super(VirtualRow.build_query(self, &block), &nil) : super
|
10
12
|
end
|
11
13
|
EOM
|
12
14
|
end
|
data/lib/wharel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wharel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5'
|
20
20
|
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '6'
|
22
|
+
version: '6.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5'
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '6'
|
32
|
+
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|