filterism 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/.gemtest +0 -0
- data/.gitignore +41 -0
- data/.rspec +3 -0
- data/.yardopts +3 -0
- data/Gemfile +4 -0
- data/LICENSE.md +10 -0
- data/README.md +74 -0
- data/Rakefile +18 -0
- data/filterism.gemspec +26 -0
- data/lib/filterism.rb +79 -0
- data/lib/filterism/version.rb +3 -0
- data/spec/filterism_spec.rb +91 -0
- data/spec/finders/activerecord_test_connector.rb +104 -0
- data/spec/fixtures/post.rb +3 -0
- data/spec/fixtures/posts.yml +16 -0
- data/spec/fixtures/schema.rb +17 -0
- data/spec/fixtures/user.rb +2 -0
- data/spec/fixtures/users.yml +30 -0
- data/spec/helper.rb +6 -0
- metadata +187 -0
data/.autotest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'autotest/bundler'
|
data/.gemtest
ADDED
File without changes
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
!.gitignore
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
*.sw[a-p]
|
5
|
+
*.tmproj
|
6
|
+
*.tmproject
|
7
|
+
*.un~
|
8
|
+
*~
|
9
|
+
.DS_Store
|
10
|
+
.Spotlight-V100
|
11
|
+
.Trashes
|
12
|
+
._*
|
13
|
+
.bundle
|
14
|
+
.config
|
15
|
+
.directory
|
16
|
+
.elc
|
17
|
+
.redcar
|
18
|
+
.yardoc
|
19
|
+
/.emacs.desktop
|
20
|
+
/.emacs.desktop.lock
|
21
|
+
Desktop.ini
|
22
|
+
Gemfile.lock
|
23
|
+
Icon?
|
24
|
+
InstalledFiles
|
25
|
+
Session.vim
|
26
|
+
Thumbs.db
|
27
|
+
\#*\#
|
28
|
+
_yardoc
|
29
|
+
auto-save-list
|
30
|
+
coverage
|
31
|
+
doc/
|
32
|
+
lib/bundler/man
|
33
|
+
pkg
|
34
|
+
pkg/*
|
35
|
+
rdoc
|
36
|
+
spec/reports
|
37
|
+
test/tmp
|
38
|
+
test/version_tmp
|
39
|
+
tmp
|
40
|
+
tmtags
|
41
|
+
tramp
|
data/.rspec
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Copyright (c) 2011, Code for America
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
* Neither the name of Code for America nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
9
|
+
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Filterism
|
2
|
+
|
3
|
+
A DSL for filtering active record results based on hash keys with the
|
4
|
+
term _is_ in them.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
### Bundler
|
9
|
+
gem 'filterism'
|
10
|
+
|
11
|
+
### Other
|
12
|
+
gem install filterism
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
Filterism was developed to fill the need of being able to filter Active Record results by aguments passed in the URL, however, it basically takes in a hash. Usually that hash would be "params" passed from the controller. The syntax of the keys in the hash control how the data is filtered.
|
16
|
+
|
17
|
+
It also adds a ".filterable_fields" method for you to limit by which fields
|
18
|
+
the records may be filtered.
|
19
|
+
|
20
|
+
## Example
|
21
|
+
### URL
|
22
|
+
http://whatever.com/whatever/?name_is_in=Dave,Jamis,David&salary_is_greater_than=10000
|
23
|
+
|
24
|
+
So as you see above, the syntax is [field]\_is\_[comparator]=value.
|
25
|
+
|
26
|
+
In the first argument, name is the [field] and [in] is the comparator.
|
27
|
+
|
28
|
+
In the second argument, salary is the [field] and [greater_than] is the comparator.
|
29
|
+
|
30
|
+
### Model
|
31
|
+
In the model you can limit which fields are filterable. This is optional. If this isn't in your model, all fields are filterable.
|
32
|
+
|
33
|
+
``` ruby
|
34
|
+
class User < ActiveRecord::Base
|
35
|
+
filterable_fields :name, :salary
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
### Controller
|
40
|
+
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.
|
41
|
+
|
42
|
+
``` ruby
|
43
|
+
users = User.filter(params).all
|
44
|
+
```
|
45
|
+
|
46
|
+
## Comparators
|
47
|
+
The current list of comparators are as follows. (taken right from the code)
|
48
|
+
|
49
|
+
``` ruby
|
50
|
+
COMPARATORS = {
|
51
|
+
'equal_to' => '=',
|
52
|
+
'not_equal_to' => '!=',
|
53
|
+
|
54
|
+
'greater_than' => '>',
|
55
|
+
'gt' => '>',
|
56
|
+
'after' => '>',
|
57
|
+
'greater_than_or_equal_to' => '>=',
|
58
|
+
'gtet' => '>=',
|
59
|
+
|
60
|
+
'less_than' => '<',
|
61
|
+
'lt' => '<',
|
62
|
+
'before' => '<',
|
63
|
+
'less_than_or_equal_to' => '<=',
|
64
|
+
'ltet' => '<=',
|
65
|
+
|
66
|
+
'like' => 'LIKE',
|
67
|
+
|
68
|
+
'in' => 'IN'
|
69
|
+
}
|
70
|
+
```
|
71
|
+
|
72
|
+
You can see that you can do things like [field]_is_gt=4000 or [field]_is_in=4,66,19
|
73
|
+
|
74
|
+
Please see https://github.com/philspitler/filterism/blob/master/spec/filterism_spec.rb for more examples of using ".filter"
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
task :default => :spec
|
10
|
+
task :test => :spec
|
11
|
+
|
12
|
+
require 'yard'
|
13
|
+
namespace :doc do
|
14
|
+
YARD::Rake::YardocTask.new do |task|
|
15
|
+
task.files = ['LICENSE.md', 'lib/**/*.rb']
|
16
|
+
task.options = ['--markup', 'markdown']
|
17
|
+
end
|
18
|
+
end
|
data/filterism.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/filterism/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'filterism'
|
6
|
+
gem.version = Filterism::VERSION
|
7
|
+
gem.author = "Phil Spitler"
|
8
|
+
gem.email = 'pspitler@gmail.com'
|
9
|
+
gem.homepage = 'https://github.com/philspitler/filterism'
|
10
|
+
gem.summary = 'A DSL for filtering active record results based on hash keys with the term _is_ in them.'
|
11
|
+
gem.description = ''
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
16
|
+
gem.require_paths = ['lib']
|
17
|
+
|
18
|
+
gem.add_development_dependency 'maruku', '~> 0.6'
|
19
|
+
gem.add_development_dependency 'rake', '~> 0.9'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
21
|
+
gem.add_development_dependency 'simplecov', '~> 0.4'
|
22
|
+
gem.add_development_dependency 'yard', '~> 0.7'
|
23
|
+
gem.add_development_dependency 'sqlite3'
|
24
|
+
|
25
|
+
gem.add_dependency 'activerecord', '>= 3.0.1'
|
26
|
+
end
|
data/lib/filterism.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
module Filterism
|
4
|
+
attr_accessor :filterable_fields
|
5
|
+
|
6
|
+
COMPARATORS = {
|
7
|
+
'equal_to' => '=',
|
8
|
+
'not_equal_to' => '!=',
|
9
|
+
|
10
|
+
'greater_than' => '>',
|
11
|
+
'gt' => '>',
|
12
|
+
'after' => '>',
|
13
|
+
'greater_than_or_equal_to' => '>=',
|
14
|
+
'gtet' => '>=',
|
15
|
+
|
16
|
+
'less_than' => '<',
|
17
|
+
'lt' => '<',
|
18
|
+
'before' => '<',
|
19
|
+
'less_than_or_equal_to' => '<=',
|
20
|
+
'ltet' => '<=',
|
21
|
+
|
22
|
+
'like' => 'LIKE',
|
23
|
+
|
24
|
+
'in' => 'IN'
|
25
|
+
}
|
26
|
+
|
27
|
+
def filter(params)
|
28
|
+
|
29
|
+
#remove non filter params
|
30
|
+
params.delete_if { |key, value| key.to_s.index('_is_').nil? }
|
31
|
+
|
32
|
+
where_clause = ""
|
33
|
+
values = []
|
34
|
+
|
35
|
+
params.each do |key, value|
|
36
|
+
keysplit = key.to_s.split('_is_')
|
37
|
+
unless @filterable_fields and not @filterable_fields.include?(keysplit[0].to_sym)
|
38
|
+
|
39
|
+
if COMPARATORS.keys.include?(keysplit[1])
|
40
|
+
column = keysplit[0]
|
41
|
+
comparator = COMPARATORS[keysplit[1]]
|
42
|
+
|
43
|
+
where_mark = '?'
|
44
|
+
|
45
|
+
if comparator == 'LIKE'
|
46
|
+
values << "%#{value}%"
|
47
|
+
elsif comparator == 'IN'
|
48
|
+
where_mark = '(?)'
|
49
|
+
values << value.split(',')
|
50
|
+
else
|
51
|
+
values << convert_if_string_is_boolean(value)
|
52
|
+
end
|
53
|
+
|
54
|
+
where_clause << " AND" unless where_clause.empty?
|
55
|
+
|
56
|
+
where_clause << " #{column} #{comparator} #{where_mark}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
where(where_clause, *values)
|
63
|
+
end
|
64
|
+
|
65
|
+
def filterable_fields(*fields)
|
66
|
+
@filterable_fields = fields
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def convert_if_string_is_boolean(value)
|
71
|
+
if value == "true" || value == "false"
|
72
|
+
value = "true" ? true : false
|
73
|
+
end
|
74
|
+
return value
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
ActiveRecord::Base.extend Filterism
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'finders/activerecord_test_connector'
|
3
|
+
ActiverecordTestConnector.setup
|
4
|
+
|
5
|
+
describe Filterism do
|
6
|
+
extend ActiverecordTestConnector::FixtureSetup
|
7
|
+
fixtures :users
|
8
|
+
fixtures :posts
|
9
|
+
|
10
|
+
it "defines the COMPARATORS constant" do
|
11
|
+
Filterism::COMPARATORS.should be
|
12
|
+
Filterism::COMPARATORS.should be_a Hash
|
13
|
+
end
|
14
|
+
|
15
|
+
it "fitlers on equal_to" do
|
16
|
+
User.filter({'name_is_equal_to' => 'David'}).first.id.should == 1
|
17
|
+
User.filter({'name_is_equal_to' => 'Dave'}).first.id.should == 2
|
18
|
+
end
|
19
|
+
|
20
|
+
it "filters on not_equal_to" do
|
21
|
+
User.filter({'name_is_not_equal_to' => 'David'}).all.count.should == 4
|
22
|
+
end
|
23
|
+
|
24
|
+
it "filters on greater_than" do
|
25
|
+
User.filter({'salary_is_greater_than' => '80000'}).all.count.should == 1
|
26
|
+
end
|
27
|
+
|
28
|
+
it "filters on gt" do
|
29
|
+
User.filter({'salary_is_gt' => '70000'}).all.count.should == 2
|
30
|
+
end
|
31
|
+
|
32
|
+
it "filters on after" do
|
33
|
+
User.filter({'salary_is_after' => '9000'}).all.count.should == 4
|
34
|
+
end
|
35
|
+
|
36
|
+
it "filters on greater_than_or_equal_to" do
|
37
|
+
User.filter({'salary_is_greater_than_or_equal_to' => '80000'}).all.count.should == 2
|
38
|
+
end
|
39
|
+
|
40
|
+
it "filters on gtet" do
|
41
|
+
User.filter({'salary_is_gtet' => '80000'}).all.count.should == 2
|
42
|
+
end
|
43
|
+
|
44
|
+
it "filters on less_than" do
|
45
|
+
User.filter({'salary_is_less_than' => '80000'}).all.count.should == 3
|
46
|
+
end
|
47
|
+
|
48
|
+
it "filters on lt" do
|
49
|
+
User.filter({'salary_is_lt' => '70000'}).all.count.should == 3
|
50
|
+
end
|
51
|
+
|
52
|
+
it "filters on before" do
|
53
|
+
User.filter({'salary_is_before' => '10000'}).all.count.should == 1
|
54
|
+
end
|
55
|
+
|
56
|
+
it "filters on less_than_or_equal_to" do
|
57
|
+
User.filter({'salary_is_less_than_or_equal_to' => '80000'}).all.count.should == 4
|
58
|
+
end
|
59
|
+
|
60
|
+
it "filters on ltet" do
|
61
|
+
User.filter({'salary_is_ltet' => '80000'}).all.count.should == 4
|
62
|
+
end
|
63
|
+
|
64
|
+
it "filters on like" do
|
65
|
+
User.filter({'name_is_like' => 'Dav'}).all.count.should == 2
|
66
|
+
end
|
67
|
+
|
68
|
+
it "filters on in" do
|
69
|
+
User.filter({'id_is_in' => '1,2,3'}).all.count.should == 3
|
70
|
+
User.filter({'name_is_in' => 'Dave,Jamis'}).all.count.should == 2
|
71
|
+
end
|
72
|
+
|
73
|
+
it "fitlers on multiple expressions" do
|
74
|
+
User.filter({'name_is_in' => 'Dave,Jamis,David', 'salary_is_gt' => '10000'}).all.count.should == 2
|
75
|
+
end
|
76
|
+
|
77
|
+
it "handles booleans properly" do
|
78
|
+
User.filter({'bonus_is_equal_to' => 'true'}).all.count.should == 3
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
it "doesn't filter if passed invalid expression" do
|
83
|
+
User.filter({'name_is_garbage' => 'David'}).all.count.should == User.all.count
|
84
|
+
end
|
85
|
+
|
86
|
+
it "uses filterable fields" do
|
87
|
+
Post.filter({'title_is_equal_to' => 'Post 1 title'}).all.count.should == 1
|
88
|
+
Post.filter({'body_is_equal_to' => 'Post 1 body'}).all.count.should == 3
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'active_record/version'
|
3
|
+
require 'active_record/fixtures'
|
4
|
+
require 'active_support/multibyte' # needed for Ruby 1.9.1
|
5
|
+
|
6
|
+
$query_count = $query_sql = nil
|
7
|
+
|
8
|
+
module ActiverecordTestConnector
|
9
|
+
extend self
|
10
|
+
|
11
|
+
attr_accessor :able_to_connect
|
12
|
+
attr_accessor :connected
|
13
|
+
|
14
|
+
FIXTURES_PATH = File.expand_path('../../fixtures', __FILE__)
|
15
|
+
|
16
|
+
# Set our defaults
|
17
|
+
self.connected = false
|
18
|
+
self.able_to_connect = true
|
19
|
+
|
20
|
+
def setup
|
21
|
+
unless self.connected || !self.able_to_connect
|
22
|
+
setup_connection
|
23
|
+
load_schema
|
24
|
+
add_load_path FIXTURES_PATH
|
25
|
+
self.connected = true
|
26
|
+
end
|
27
|
+
rescue Exception => e # errors from ActiveRecord setup
|
28
|
+
$stderr.puts "\nSkipping ActiveRecord tests: #{e}\n\n"
|
29
|
+
self.able_to_connect = false
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def add_load_path(path)
|
35
|
+
dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
|
36
|
+
dep.autoload_paths.unshift path
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup_connection
|
40
|
+
ActiveRecord::Base.establish_connection(
|
41
|
+
:adapter => "sqlite3",
|
42
|
+
:database => ":memory:"
|
43
|
+
)
|
44
|
+
prepare ActiveRecord::Base.connection
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_schema
|
48
|
+
ActiveRecord::Base.silence do
|
49
|
+
ActiveRecord::Migration.verbose = false
|
50
|
+
load File.join(FIXTURES_PATH, 'schema.rb')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def prepare(conn)
|
55
|
+
class << conn
|
56
|
+
IGNORED_SQL = /^(?:PRAGMA|SELECT (?:currval|CAST|@@IDENTITY|@@ROWCOUNT)|SHOW FIELDS)\b/
|
57
|
+
|
58
|
+
def execute_with_counting(sql, name = nil, &block)
|
59
|
+
if $query_count and IGNORED_SQL !~ sql
|
60
|
+
$query_count += 1
|
61
|
+
$query_sql << sql
|
62
|
+
end
|
63
|
+
execute_without_counting(sql, name, &block)
|
64
|
+
end
|
65
|
+
|
66
|
+
alias_method_chain :execute, :counting
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module FixtureSetup
|
71
|
+
def fixtures(*tables)
|
72
|
+
table_names = tables.map { |t| t.to_s }
|
73
|
+
|
74
|
+
fixtures = Fixtures.create_fixtures ActiverecordTestConnector::FIXTURES_PATH, table_names
|
75
|
+
@@loaded_fixtures = {}
|
76
|
+
@@fixture_cache = {}
|
77
|
+
|
78
|
+
unless fixtures.nil?
|
79
|
+
if fixtures.instance_of?(Fixtures)
|
80
|
+
@@loaded_fixtures[fixtures.table_name] = fixtures
|
81
|
+
else
|
82
|
+
fixtures.each { |f| @@loaded_fixtures[f.table_name] = f }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
table_names.each do |table_name|
|
87
|
+
define_method(table_name) do |*fixtures|
|
88
|
+
@@fixture_cache[table_name] ||= {}
|
89
|
+
|
90
|
+
instances = fixtures.map do |fixture|
|
91
|
+
if @@loaded_fixtures[table_name][fixture.to_s]
|
92
|
+
@@fixture_cache[table_name][fixture] ||= @@loaded_fixtures[table_name][fixture.to_s].find
|
93
|
+
else
|
94
|
+
raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
instances.size == 1 ? instances.first : instances
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
create_table "users", :force => true do |t|
|
3
|
+
t.column "name", :text
|
4
|
+
t.column "salary", :integer, :default => 70000
|
5
|
+
t.column "bonus", :boolean, :default => false
|
6
|
+
t.column "created_at", :datetime
|
7
|
+
t.column "updated_at", :datetime
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table "posts", :force => true do |t|
|
11
|
+
t.column "title", :string
|
12
|
+
t.column "body", :text
|
13
|
+
t.column "published_at", :datetime
|
14
|
+
t.column "created_at", :datetime
|
15
|
+
t.column "updated_at", :datetime
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
david:
|
2
|
+
id: 1
|
3
|
+
name: David
|
4
|
+
salary: 80000
|
5
|
+
bonus: true
|
6
|
+
|
7
|
+
dave:
|
8
|
+
id: 2
|
9
|
+
name: Dave
|
10
|
+
salary: 150000
|
11
|
+
bonus: true
|
12
|
+
|
13
|
+
poor_jamis:
|
14
|
+
id: 3
|
15
|
+
name: Jamis
|
16
|
+
salary: 9000
|
17
|
+
bonus: true
|
18
|
+
|
19
|
+
admin:
|
20
|
+
id: 12
|
21
|
+
name: admin
|
22
|
+
salary: 10000
|
23
|
+
bonus: false
|
24
|
+
|
25
|
+
goofy:
|
26
|
+
id: 13
|
27
|
+
name: Goofy
|
28
|
+
salary: 11000
|
29
|
+
bonus: false
|
30
|
+
|
data/spec/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: filterism
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Phil Spitler
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-06-09 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: maruku
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 6
|
31
|
+
version: "0.6"
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rake
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 9
|
45
|
+
version: "0.9"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 2
|
58
|
+
- 6
|
59
|
+
version: "2.6"
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: simplecov
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
- 4
|
73
|
+
version: "0.4"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: yard
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
- 7
|
87
|
+
version: "0.7"
|
88
|
+
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: sqlite3
|
92
|
+
prerelease: false
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
type: :development
|
102
|
+
version_requirements: *id006
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: activerecord
|
105
|
+
prerelease: false
|
106
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
segments:
|
112
|
+
- 3
|
113
|
+
- 0
|
114
|
+
- 1
|
115
|
+
version: 3.0.1
|
116
|
+
type: :runtime
|
117
|
+
version_requirements: *id007
|
118
|
+
description: ""
|
119
|
+
email: pspitler@gmail.com
|
120
|
+
executables: []
|
121
|
+
|
122
|
+
extensions: []
|
123
|
+
|
124
|
+
extra_rdoc_files: []
|
125
|
+
|
126
|
+
files:
|
127
|
+
- .autotest
|
128
|
+
- .gemtest
|
129
|
+
- .gitignore
|
130
|
+
- .rspec
|
131
|
+
- .yardopts
|
132
|
+
- Gemfile
|
133
|
+
- LICENSE.md
|
134
|
+
- README.md
|
135
|
+
- Rakefile
|
136
|
+
- filterism.gemspec
|
137
|
+
- lib/filterism.rb
|
138
|
+
- lib/filterism/version.rb
|
139
|
+
- spec/filterism_spec.rb
|
140
|
+
- spec/finders/activerecord_test_connector.rb
|
141
|
+
- spec/fixtures/post.rb
|
142
|
+
- spec/fixtures/posts.yml
|
143
|
+
- spec/fixtures/schema.rb
|
144
|
+
- spec/fixtures/user.rb
|
145
|
+
- spec/fixtures/users.yml
|
146
|
+
- spec/helper.rb
|
147
|
+
has_rdoc: true
|
148
|
+
homepage: https://github.com/philspitler/filterism
|
149
|
+
licenses: []
|
150
|
+
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
version: "0"
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
segments:
|
170
|
+
- 0
|
171
|
+
version: "0"
|
172
|
+
requirements: []
|
173
|
+
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 1.3.7
|
176
|
+
signing_key:
|
177
|
+
specification_version: 3
|
178
|
+
summary: A DSL for filtering active record results based on hash keys with the term _is_ in them.
|
179
|
+
test_files:
|
180
|
+
- spec/filterism_spec.rb
|
181
|
+
- spec/finders/activerecord_test_connector.rb
|
182
|
+
- spec/fixtures/post.rb
|
183
|
+
- spec/fixtures/posts.yml
|
184
|
+
- spec/fixtures/schema.rb
|
185
|
+
- spec/fixtures/user.rb
|
186
|
+
- spec/fixtures/users.yml
|
187
|
+
- spec/helper.rb
|