mundane-search 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +4 -1
- data/.travis.yml +6 -0
- data/Gemfile +4 -1
- data/README.md +44 -30
- data/Rakefile +8 -1
- data/lib/mundane-search.rb +2 -1
- data/lib/mundane-search/filter_canister.rb +4 -11
- data/lib/mundane-search/filters/attribute_match.rb +2 -2
- data/lib/mundane-search/filters/attribute_substring.rb +2 -3
- data/lib/mundane-search/filters/multi_order.rb +78 -0
- data/lib/mundane-search/filters/operator.rb +2 -2
- data/lib/mundane-search/filters/order.rb +9 -3
- data/lib/mundane-search/filters/typical.rb +13 -9
- data/lib/mundane-search/param_key_types.rb +43 -0
- data/lib/mundane-search/result.rb +0 -2
- data/lib/mundane-search/result_model.rb +6 -5
- data/lib/mundane-search/version.rb +1 -1
- data/lib/mundane-search/view_helpers.rb +16 -2
- data/mundane-search.gemspec +2 -1
- data/spec/active_record_setup.rb +2 -1
- data/spec/buildable_integration_spec.rb +1 -1
- data/spec/builder_integration_spec.rb +4 -4
- data/spec/filter_canister_spec.rb +9 -8
- data/spec/filters/attribute_match_integration_spec.rb +2 -2
- data/spec/filters/attribute_match_spec.rb +2 -2
- data/spec/filters/attribute_substring_spec.rb +2 -2
- data/spec/filters/exact_match_spec.rb +2 -2
- data/spec/filters/multi_order_integration_spec.rb +42 -0
- data/spec/filters/multi_order_spec.rb +46 -0
- data/spec/filters/operator_integration_spec.rb +2 -2
- data/spec/filters/operator_spec.rb +2 -2
- data/spec/filters/order_integration_spec.rb +14 -2
- data/spec/filters/order_spec.rb +25 -4
- data/spec/filters/shortcuts_integration_spec.rb +1 -1
- data/spec/filters/typical_spec.rb +6 -7
- data/spec/filters_spec.rb +1 -1
- data/spec/form_integration_spec.rb +1 -1
- data/spec/minitest_helper.rb +17 -2
- data/spec/param_key_types_spec.rb +29 -0
- data/spec/result_integration_spec.rb +1 -1
- data/spec/result_model_spec.rb +3 -2
- data/spec/search_url_for_integration_spec.rb +15 -0
- data/spec/simple_form_integration_spec.rb +3 -5
- metadata +57 -83
- data/bin/coderay +0 -16
- data/bin/erubis +0 -16
- data/bin/guard +0 -16
- data/bin/pry +0 -16
- data/bin/rackup +0 -16
- data/bin/rake +0 -16
- data/bin/sprockets +0 -16
- data/bin/thor +0 -16
- data/bin/tilt +0 -16
- data/lib/columns_hash.rb +0 -38
- data/spec/columns_hash_spec.rb +0 -37
data/bin/coderay
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'coderay' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('mundane-search', 'coderay')
|
data/bin/erubis
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'erubis' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('erubis', 'erubis')
|
data/bin/guard
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'guard' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('guard', 'guard')
|
data/bin/pry
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'pry' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('mundane-search', 'pry')
|
data/bin/rackup
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rackup' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('rack', 'rackup')
|
data/bin/rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rake' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('mundane-search', 'rake')
|
data/bin/sprockets
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'sprockets' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('sprockets', 'sprockets')
|
data/bin/thor
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'thor' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('thor', 'thor')
|
data/bin/tilt
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'tilt' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('tilt', 'tilt')
|
data/lib/columns_hash.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
require 'active_support/concern'
|
3
|
-
|
4
|
-
module ColumnsHash
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
class Attribute < OpenStruct
|
7
|
-
def number?
|
8
|
-
number
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.generate(options)
|
13
|
-
type = options[:type]
|
14
|
-
attribute = Attribute.new(options)
|
15
|
-
case type
|
16
|
-
when :string
|
17
|
-
attribute.limit = 255
|
18
|
-
when :integer, :float
|
19
|
-
attribute.number = true
|
20
|
-
end
|
21
|
-
attribute
|
22
|
-
end
|
23
|
-
|
24
|
-
module ClassMethods
|
25
|
-
def columns_hash
|
26
|
-
@columns_hash ||= {}
|
27
|
-
end
|
28
|
-
|
29
|
-
def attribute_column(name, attribute_type)
|
30
|
-
columns_hash[name] = ColumnsHash.generate({name: name, type: attribute_type})
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def column_for_attribute(attribute)
|
35
|
-
self.class.columns_hash[attribute]
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/spec/columns_hash_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative 'minitest_helper'
|
2
|
-
|
3
|
-
describe ColumnsHash do
|
4
|
-
[:binary, :boolean, :date, :datetime, :decimal, :float, :integer, :primary_key, :string, :text, :time, :timestamp].each do |type|
|
5
|
-
it "should respond to all ActiveRecord type #{type}" do
|
6
|
-
ColumnsHash.generate({type: type}).must_be_kind_of ColumnsHash::Attribute
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should have 255 limit when string" do
|
11
|
-
ColumnsHash.generate({type: :string}).limit.must_equal 255
|
12
|
-
end
|
13
|
-
|
14
|
-
[:float, :integer].each do |type|
|
15
|
-
it "should be number? true when #{type}" do
|
16
|
-
ColumnsHash.generate({type: type}).number?.must_equal true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "applied to class" do
|
21
|
-
let(:columned_class) do
|
22
|
-
Class.new do
|
23
|
-
include ColumnsHash
|
24
|
-
end
|
25
|
-
end
|
26
|
-
let(:columned) { columned_class.new }
|
27
|
-
|
28
|
-
it "should have a columns_hash" do
|
29
|
-
columned_class.columns_hash.must_be_kind_of Hash
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should store (and retrieve) a column type" do
|
33
|
-
columned_class.attribute_column(:title, :string)
|
34
|
-
columned.column_for_attribute(:title).type.must_equal :string
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|