filta 0.0.1 → 0.0.2

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: 45d752a78edbc8402af285499267d8cfaa2bc4cb
4
- data.tar.gz: e4f632cdb33e61021e0ce574cc66de0bee311610
3
+ metadata.gz: fc34f7efbbf6feb66689560ffccbaf7bca8d1e83
4
+ data.tar.gz: 231d66d87ff55f49eb73056fcdc478c5344b6763
5
5
  SHA512:
6
- metadata.gz: c1b3179c65bd0dacdb2aa5b9ac04578a6944c00666be22152d3346ede4290904bd3ea42143e92725223376dc788d0ff99842f8931ff996f04a8d6e8ba3484fd9
7
- data.tar.gz: a2867c763561fba43d98a28b2e6b7a3ac1bb688641f78a376fa67a503431b752b885483201b4540d0d3b8583805b3bec8be7e0803f3363e32d0fe302480d8fbf
6
+ metadata.gz: 25bed89dd3ba7f78310aee7db5c989e02b3368e5ae95fb3adf0b4c3e9fb02866810541339f8881d302d12e7792863edb737bbccb4bd54bf77c42c1e708296ff4
7
+ data.tar.gz: 30db3e608cc2e9733fca78859abbda449a26de13a097f7beed2f7a11f568d279dcfd8da02a42d84efcd297556ba1327c85395286f13ddccb752aa11809974ccf
data/README.md CHANGED
@@ -8,6 +8,7 @@ Super simple filtering for ActiveRecord, inspired by [Justin Weiss' Gist](https:
8
8
  - [Installation](#installation)
9
9
  - [Contributing](#contributing)
10
10
  - [License](#license)
11
+ - [TODO](#todo)
11
12
 
12
13
  <!-- /MarkdownTOC -->
13
14
 
@@ -49,3 +50,7 @@ $ gem install filta
49
50
  ## License
50
51
 
51
52
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
53
+
54
+ ## TODO
55
+
56
+ * Finish README
@@ -0,0 +1,9 @@
1
+ require "filta/methods"
2
+
3
+ module Filta
4
+
5
+ ActiveSupport.on_load(:active_record) do
6
+ include Filta::Methods
7
+ end
8
+
9
+ end
@@ -0,0 +1,21 @@
1
+ module Filta
2
+ module Methods
3
+
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def filter(by)
10
+ results = self.where(nil)
11
+
12
+ by.each do |key, value|
13
+ results = results.where("#{key} = ?", value) if value.present?
14
+ end
15
+
16
+ results
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module Filta
2
+ VERSION = File.read("VERSION").split("\n").first
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :filta do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Chinery
@@ -77,6 +77,10 @@ files:
77
77
  - MIT-LICENSE
78
78
  - README.md
79
79
  - Rakefile
80
+ - lib/filta.rb
81
+ - lib/filta/methods.rb
82
+ - lib/filta/version.rb
83
+ - lib/tasks/filta.rake
80
84
  homepage: https://github.com/sleepingstu/filta
81
85
  licenses:
82
86
  - MIT