filterism 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5702e936b3509a35a0988602855c6ec4a8e0e758
4
- data.tar.gz: 91adb5ae786eee091d36df6938391660b7b68d36
3
+ metadata.gz: 702e375614a34c3ccc1f0b2225d9e3d34f89fe4a
4
+ data.tar.gz: f700e3efb545b7b647c9ba6eeefed66a3c194ef4
5
5
  SHA512:
6
- metadata.gz: 9205254ef687c7a6dfbd695ff9833b5feef1b8efaf7554ad16e03f3d4b67b4b6dfcdd71e86ffd9c2cbda08634fce39fb4492d1c345bbafa58b3610d42137c67e
7
- data.tar.gz: 32035e5f2ac954fc310c82ca6f2a68a5a44de173f00d52c325f8331e112d3a827aed00151317ec5e97c019e997a07113fdec3f694ddf3aab0fb2ead7298d6b3b
6
+ metadata.gz: 31e0392b503b2a212623c35d08e0224acf81acf046e8a88d73dce9cee484362cdc969700565f944bb8383f4c4fd37ec002face53d53f4c6dede2e19d7014d779
7
+ data.tar.gz: 9d6281f69aaddbb70f3084c674cc34990ae0e2b0223426d7cbc7d5fe3cd26db69755299eeeee02a38899fc967ff2ee50c80ecc7031fbfe39714e4c5f4b6d12c9
data/README.md CHANGED
@@ -69,7 +69,9 @@ The examples above are equivalent. If you have a long list of fields, you can u
69
69
  This gem adds the ".filter" class method to any active record class. You can pass in any hash, it doesn't have to operate from params. It will only look at keys that have the "\_is\_" syntax.
70
70
 
71
71
  ``` ruby
72
- users = User.filter(params).all
72
+ parser = Filterism::ParamsParser.new
73
+ parsed_params = parser.parse(params)
74
+ users = User.filter(parsed_params).all
73
75
  ```
74
76
 
75
77
  ## Comparators
@@ -1,5 +1,5 @@
1
1
  module Filterism
2
- class ConditionParser
2
+ class ParamsParser
3
3
  attr_accessor :comparators
4
4
  def initialize
5
5
  @comparators = {
@@ -1,3 +1,3 @@
1
1
  module Filterism
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Filterism::ConditionParser do
3
+ describe Filterism::ParamsParser do
4
4
  before(:all) do
5
- @condition_parser = Filterism::ConditionParser.new
5
+ @params_parser = Filterism::ParamsParser.new
6
6
  end
7
7
 
8
8
  describe "#parse" do
9
9
  it "has the parse method" do
10
- expect(@condition_parser).to respond_to(:parse)
10
+ expect(@params_parser).to respond_to(:parse)
11
11
  end
12
- subject { -> (params) { return @condition_parser.parse(params) }}
12
+ subject { -> (params) { return @params_parser.parse(params) }}
13
13
 
14
14
  it "returns a hash" do
15
15
  expect(subject.call({ name_is_equal_to: 'David' })).to be_an(Array)
@@ -30,22 +30,22 @@ describe Filterism::ConditionParser do
30
30
 
31
31
  describe "#add_comparator" do
32
32
  it "has the add_comparator method" do
33
- expect(@condition_parser).to respond_to(:add_comparator).with(1).argument
33
+ expect(@params_parser).to respond_to(:add_comparator).with(1).argument
34
34
  end
35
35
 
36
36
  it "adds the new comparator to the comparators Hash" do
37
- expect(@condition_parser.add_comparator({"equals_to" => "="})).to include("equals_to" => "=")
37
+ expect(@params_parser.add_comparator({"equals_to" => "="})).to include("equals_to" => "=")
38
38
  end
39
39
  end
40
40
 
41
41
  describe "#delete_comparator" do
42
42
  it "has the delete_comparator method" do
43
- expect(@condition_parser).to respond_to(:delete_comparator).with(1).argument
43
+ expect(@params_parser).to respond_to(:delete_comparator).with(1).argument
44
44
  end
45
45
 
46
46
  it "deletes the comparator from the comparators Hash" do
47
- @condition_parser.add_comparator({"equals_to" => "="})
48
- expect(@condition_parser.delete_comparator("equals_to")).not_to include("equals_to")
47
+ @params_parser.add_comparator({"equals_to" => "="})
48
+ expect(@params_parser.delete_comparator("equals_to")).not_to include("equals_to")
49
49
  end
50
50
  end
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filterism
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Spitler