query_string_filter 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/filter.treetop +13 -0
- data/query_string_filter.gemspec +1 -1
- data/spec/query_string_filter_spec.rb +19 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/filter.treetop
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
grammar Filter
|
2
2
|
|
3
3
|
rule match
|
4
|
+
and_expression / simple
|
5
|
+
end
|
6
|
+
|
7
|
+
rule and_expression
|
8
|
+
simple ospace 'and' ospace match
|
9
|
+
{
|
10
|
+
def eval
|
11
|
+
simple.eval.merge(match.eval)
|
12
|
+
end
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
rule simple
|
4
17
|
fuzzy / equality / inequality
|
5
18
|
end
|
6
19
|
|
data/query_string_filter.gemspec
CHANGED
@@ -130,5 +130,24 @@ describe "QueryStringFilter" do
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
133
|
+
|
134
|
+
describe "and" do
|
135
|
+
it "double" do
|
136
|
+
actual = %(format="xml" and count=13)
|
137
|
+
@filter.parse(actual).should == {
|
138
|
+
"format" => "xml",
|
139
|
+
"count" => 13,
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
143
|
+
it "triple" do
|
144
|
+
actual = %(format="xml" and count=13 and size=64)
|
145
|
+
@filter.parse(actual).should == {
|
146
|
+
"format" => "xml",
|
147
|
+
"count" => 13,
|
148
|
+
"size" => 64,
|
149
|
+
}
|
150
|
+
end
|
151
|
+
end
|
133
152
|
|
134
153
|
end
|