filta 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -3
  3. data/VERSION +1 -1
  4. data/lib/filta/methods.rb +9 -2
  5. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffb8b7ffdb299c6a6011e0036050239a0186f9bb252c6fd33578493e89eee562
4
- data.tar.gz: 5152e2f8e5525120b922f1bb610ff096d7fb64d7477bad9bccf469b77a5470ac
3
+ metadata.gz: e6f7c7b008c76c763d91d697460e4265d36bece571bb49c13e4e77c18a460715
4
+ data.tar.gz: 0c999a1fcda30565db120ae3b2e5aeff6b488422a519c8383d5022e4a2b19dc2
5
5
  SHA512:
6
- metadata.gz: f5d46eea9efb2a11fbfb4a7df20832e18b6c4e7ce1858ee0f9ba41b6a0b36964fe68606cb32b172d11aaaf3ddf9eb556f7ba0b1dc179894c5e41590dee36c90f
7
- data.tar.gz: ab75e226447cd8f44f9b47734c4709aa1201ac142840172eaedd82962f455f1509f73a5c2d9ea80b51874b32126e0396b90b4515db03c300a1d3d8ae27b2ad31
6
+ metadata.gz: a48a978fc3f808a84c013e31b54927dde0a7acba771b4aaf66dd60e2dfd48dc5465ae27a500db345b88ef431679dd382d0883e9b3359b3200317246feac18ac5
7
+ data.tar.gz: 65b963491fba5d459af30afa9f6819af2154f0988933429d116a98e7feb0c9ad04b4242e5ef110b3b8fc976889e0f863df3d4b53041b9a019d53d5dfbe53b2db
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Super simple filtering for ActiveRecord, inspired by [Justin Weiss' Gist](https://gist.github.com/justinweiss/9065666).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/filta.svg)](https://badge.fury.io/rb/filta)
6
- [![Build Status](https://travis-ci.org/sleepingstu/filta.svg?branch=master)](https://travis-ci.org/sleepingstu/filta)
6
+ [![Build Status](https://travis-ci.org/boxt/filta.svg?branch=master)](https://travis-ci.org/sleepingstu/filta)
7
7
 
8
8
  <!-- MarkdownTOC -->
9
9
 
@@ -39,17 +39,21 @@ $ gem install filta
39
39
  Use like you would any other kind of ActiveRecord scope.
40
40
 
41
41
  ```ruby
42
- @filtered = Klass.filter({ title: "Foo", something: "Bar" })
42
+ @filtered = Klass.filta({ title: "Foo", something: "Bar" })
43
43
  ```
44
44
 
45
45
  The `filter` method returns an ActiveRecord relation so you can chain the calls with other methods.
46
46
 
47
47
  ```ruby
48
- Klass.filter({ title: "Foo" }).order("created_at DESC")
48
+ Klass.filta({ title: "Foo" }).order("created_at DESC")
49
49
  ```
50
50
 
51
51
  If using in a controller make sure you use the `params.permit` method to sanitise what you pass into the `filter` method.
52
52
 
53
+ ## Notes
54
+
55
+ The original `.filter` method is deprecated to avoid any confusion
56
+
53
57
 
54
58
  ## Contributing
55
59
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.1
@@ -7,15 +7,22 @@ module Filta
7
7
  end
8
8
 
9
9
  module ClassMethods
10
- def filter(by)
10
+ def filta(by)
11
11
  results = where(nil)
12
12
 
13
13
  by.each do |key, value|
14
- results = results.where(key.to_s.to_sym => value) if value.present?
14
+ next unless value.present?
15
+
16
+ results = results.where(key.to_s.to_sym => value)
15
17
  end
16
18
 
17
19
  results
18
20
  end
21
+
22
+ # TODO: This method is now deprecated and should be removed at a later date
23
+ def filter(by)
24
+ filta(by)
25
+ end
19
26
  end
20
27
  end
21
28
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Chinery
8
+ - Lorenzo Tello
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
12
+ date: 2019-08-01 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
@@ -16,14 +17,14 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '5.0'
20
+ version: '5.2'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '5.0'
27
+ version: '5.2'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: minitest
29
30
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +70,7 @@ dependencies:
69
70
  description: Super simple filtering for ActiveRecord, inspired by Justin Weiss' Gist
70
71
  - https://gist.github.com/justinweiss/9065666
71
72
  email:
72
- - stuart.chinery@gmail.com
73
+ - developers@boxt.co.uk
73
74
  executables: []
74
75
  extensions: []
75
76
  extra_rdoc_files: []
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubygems_version: 3.0.1
105
+ rubygems_version: 3.0.3
105
106
  signing_key:
106
107
  specification_version: 4
107
108
  summary: Super simple filtering for ActiveRecord