rexle 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rexle.rb +6 -4
- metadata +2 -2
data/lib/rexle.rb
CHANGED
@@ -159,18 +159,20 @@ class Rexle
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def format_attributes(condition)
|
162
|
-
raw_items = condition[1..-1].scan(/\'[^\']*\'|and|\d+|[!=]+|[@\w\.]+/)
|
162
|
+
raw_items = condition[1..-1].scan(/\'[^\']*\'|and|or|\d+|[!=]+|[@\w\.]+/)
|
163
163
|
|
164
164
|
if raw_items[0][/^\d+$/] then
|
165
165
|
return raw_items[0].to_i
|
166
166
|
else
|
167
167
|
|
168
|
-
|
169
|
-
|
168
|
+
andor_items = raw_items.map.with_index.select{|x,i| x[/and|or/]}.map{|x| [x.last, x.last + 1]}.flatten
|
169
|
+
|
170
|
+
indices = [0] + andor_items + [raw_items.length]
|
170
171
|
|
171
172
|
if raw_items[0][0] == '@' then
|
172
|
-
raw_items
|
173
|
+
raw_items.each{|x| x.gsub!(/^@/,'')}
|
173
174
|
cons_items = indices.each_cons(2).map{|x,y| raw_items.slice(x...y)}
|
175
|
+
|
174
176
|
items = cons_items.map do |x|
|
175
177
|
if x.length >= 3 then
|
176
178
|
x[1] = '==' if x[1] == '='
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors: []
|
7
7
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-11-
|
12
|
+
date: 2010-11-19 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|