refinuri 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/TODO +4 -0
- data/VERSION +1 -1
- data/lib/refinuri.rb +2 -2
- data/lib/refinuri/query.rb +8 -6
- data/refinuri-0.5.1.gem +0 -0
- data/refinuri.gemspec +8 -3
- data/test/helper.rb +1 -0
- data/test/test_rails_integration.rb +33 -0
- metadata +7 -2
data/TODO
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/lib/refinuri.rb
CHANGED
@@ -14,5 +14,5 @@ module Refinuri
|
|
14
14
|
include Refinuri::Query
|
15
15
|
end
|
16
16
|
|
17
|
-
ActionView::Base.send
|
18
|
-
ActiveRecord::Base.send
|
17
|
+
ActionView::Base.send(:include, Refinuri::Helpers) if Object.const_defined?("ActionView")
|
18
|
+
ActiveRecord::Base.send(:extend, Refinuri::Query) if Object.const_defined?("ActiveRecord")
|
data/lib/refinuri/query.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
module Refinuri
|
2
2
|
module Query
|
3
3
|
def filtered(filterset)
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
if filterset.is_a?(Refinuri::Base::FilterSet)
|
5
|
+
filtered_self = self.scoped
|
6
|
+
|
7
7
|
filterset.filters.each do |name,filter_obj|
|
8
8
|
filtered_self = filtered_self.where(filter_obj.to_db)
|
9
|
-
end
|
9
|
+
end
|
10
|
+
|
11
|
+
return filtered_self.scoped
|
12
|
+
else
|
13
|
+
return self
|
10
14
|
end
|
11
|
-
|
12
|
-
return filtered_self.scoped
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
data/refinuri-0.5.1.gem
ADDED
Binary file
|
data/refinuri.gemspec
CHANGED
@@ -5,22 +5,24 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{refinuri}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chris Kalafarski"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-08}
|
13
13
|
s.description = %q{Helps clean up complex URLs with filtering query string, like you may find in an online store}
|
14
14
|
s.email = %q{chris@farski.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.md"
|
17
|
+
"README.md",
|
18
|
+
"TODO"
|
18
19
|
]
|
19
20
|
s.files = [
|
20
21
|
".gitignore",
|
21
22
|
"LICENSE",
|
22
23
|
"README.md",
|
23
24
|
"Rakefile",
|
25
|
+
"TODO",
|
24
26
|
"VERSION",
|
25
27
|
"lib/refinuri.rb",
|
26
28
|
"lib/refinuri/base.rb",
|
@@ -29,11 +31,13 @@ Gem::Specification.new do |s|
|
|
29
31
|
"lib/refinuri/parser.rb",
|
30
32
|
"lib/refinuri/query.rb",
|
31
33
|
"lib/refinuri/utilities.rb",
|
34
|
+
"refinuri-0.5.1.gem",
|
32
35
|
"refinuri.gemspec",
|
33
36
|
"test/helper.rb",
|
34
37
|
"test/test_array_filters.rb",
|
35
38
|
"test/test_helpers.rb",
|
36
39
|
"test/test_parser.rb",
|
40
|
+
"test/test_rails_integration.rb",
|
37
41
|
"test/test_range_filters.rb",
|
38
42
|
"test/test_refinuri.rb",
|
39
43
|
"test/test_unbounded_range_filters.rb",
|
@@ -49,6 +53,7 @@ Gem::Specification.new do |s|
|
|
49
53
|
"test/test_array_filters.rb",
|
50
54
|
"test/test_helpers.rb",
|
51
55
|
"test/test_parser.rb",
|
56
|
+
"test/test_rails_integration.rb",
|
52
57
|
"test/test_range_filters.rb",
|
53
58
|
"test/test_refinuri.rb",
|
54
59
|
"test/test_unbounded_range_filters.rb",
|
data/test/helper.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestRailsIntegration < Test::Unit::TestCase
|
4
|
+
context "ActiveRecord objects" do
|
5
|
+
setup do
|
6
|
+
class Item < ActiveRecord::Base
|
7
|
+
end
|
8
|
+
|
9
|
+
@item = Item
|
10
|
+
@set = Refinuri::Base::FilterSet.new({ :name => 'apple' })
|
11
|
+
end
|
12
|
+
|
13
|
+
should "should respond to #filtered" do
|
14
|
+
assert Item.respond_to?("filtered")
|
15
|
+
end
|
16
|
+
|
17
|
+
should "act unaltered if #filtered isn't given a FilterSet" do
|
18
|
+
assert_equal @item, Item.filtered(nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
should "act filtered if #filtered is given a FilterSet" do
|
22
|
+
# assert_equal @item, Item.filtered(@set)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "ActionView" do
|
27
|
+
should "make filter_with_link available" do
|
28
|
+
end
|
29
|
+
|
30
|
+
should "make toggle_filter_with_link available" do
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinuri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Kalafarski
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-08 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -31,11 +31,13 @@ extensions: []
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- LICENSE
|
33
33
|
- README.md
|
34
|
+
- TODO
|
34
35
|
files:
|
35
36
|
- .gitignore
|
36
37
|
- LICENSE
|
37
38
|
- README.md
|
38
39
|
- Rakefile
|
40
|
+
- TODO
|
39
41
|
- VERSION
|
40
42
|
- lib/refinuri.rb
|
41
43
|
- lib/refinuri/base.rb
|
@@ -44,11 +46,13 @@ files:
|
|
44
46
|
- lib/refinuri/parser.rb
|
45
47
|
- lib/refinuri/query.rb
|
46
48
|
- lib/refinuri/utilities.rb
|
49
|
+
- refinuri-0.5.1.gem
|
47
50
|
- refinuri.gemspec
|
48
51
|
- test/helper.rb
|
49
52
|
- test/test_array_filters.rb
|
50
53
|
- test/test_helpers.rb
|
51
54
|
- test/test_parser.rb
|
55
|
+
- test/test_rails_integration.rb
|
52
56
|
- test/test_range_filters.rb
|
53
57
|
- test/test_refinuri.rb
|
54
58
|
- test/test_unbounded_range_filters.rb
|
@@ -86,6 +90,7 @@ test_files:
|
|
86
90
|
- test/test_array_filters.rb
|
87
91
|
- test/test_helpers.rb
|
88
92
|
- test/test_parser.rb
|
93
|
+
- test/test_rails_integration.rb
|
89
94
|
- test/test_range_filters.rb
|
90
95
|
- test/test_refinuri.rb
|
91
96
|
- test/test_unbounded_range_filters.rb
|