dragoon_system 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/dragoon_system.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dragoon_system}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["zhanyinan"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-02}
|
13
13
|
s.description = %q{personal suit}
|
14
14
|
s.email = %q{toward7seas@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,10 +27,9 @@ Gem::Specification.new do |s|
|
|
27
27
|
"dragoon_system.gemspec",
|
28
28
|
"lib/active_record/base_patch.rb",
|
29
29
|
"lib/dragoon_system.rb",
|
30
|
-
"lib/
|
31
|
-
"lib/
|
32
|
-
"test/helper.rb"
|
33
|
-
"test/test_dragoon_system.rb"
|
30
|
+
"lib/module_patch.rb",
|
31
|
+
"lib/string_patch.rb",
|
32
|
+
"test/helper.rb"
|
34
33
|
]
|
35
34
|
s.homepage = %q{http://github.com/toward7seas01/dragoon_system}
|
36
35
|
s.licenses = ["MIT"]
|
@@ -38,8 +37,7 @@ Gem::Specification.new do |s|
|
|
38
37
|
s.rubygems_version = %q{1.5.2}
|
39
38
|
s.summary = %q{personal suit}
|
40
39
|
s.test_files = [
|
41
|
-
"test/helper.rb"
|
42
|
-
"test/test_dragoon_system.rb"
|
40
|
+
"test/helper.rb"
|
43
41
|
]
|
44
42
|
|
45
43
|
if s.respond_to? :specification_version then
|
@@ -20,6 +20,30 @@ module ActiveRecord
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def fuzzy(args)
|
24
|
+
or_empty_scope(args) do
|
25
|
+
query_params = []
|
26
|
+
query_string = []
|
27
|
+
|
28
|
+
args.each {|model, attrs|
|
29
|
+
table, field, data = model, *attrs.to_a.flatten
|
30
|
+
table, field, data = [table.table_name, field.to_s, handle_input(data).join("|")]
|
31
|
+
|
32
|
+
unless data.blank?
|
33
|
+
query_string << "#{table}.#{field} regexp ?"
|
34
|
+
query_params << data
|
35
|
+
end
|
36
|
+
}
|
37
|
+
|
38
|
+
unless query_string.empty?
|
39
|
+
query_string = query_string.join(" or ")
|
40
|
+
scoped({:conditions => [query_string] + query_params})
|
41
|
+
else
|
42
|
+
scoped
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
23
47
|
def newest
|
24
48
|
scoped(:order => "#{self.table_name}.updated_at desc")
|
25
49
|
end
|
@@ -61,7 +85,7 @@ module ActiveRecord
|
|
61
85
|
def regexp_condition(field, data, table)
|
62
86
|
or_empty_scope(data) do
|
63
87
|
data = handle_input(data).join("|")
|
64
|
-
|
88
|
+
where("#{table}.#{field} regexp ? ", data)
|
65
89
|
end
|
66
90
|
end
|
67
91
|
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragoon_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- zhanyinan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-02 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -100,10 +100,9 @@ files:
|
|
100
100
|
- dragoon_system.gemspec
|
101
101
|
- lib/active_record/base_patch.rb
|
102
102
|
- lib/dragoon_system.rb
|
103
|
-
- lib/
|
104
|
-
- lib/
|
103
|
+
- lib/module_patch.rb
|
104
|
+
- lib/string_patch.rb
|
105
105
|
- test/helper.rb
|
106
|
-
- test/test_dragoon_system.rb
|
107
106
|
has_rdoc: true
|
108
107
|
homepage: http://github.com/toward7seas01/dragoon_system
|
109
108
|
licenses:
|
@@ -140,4 +139,3 @@ specification_version: 3
|
|
140
139
|
summary: personal suit
|
141
140
|
test_files:
|
142
141
|
- test/helper.rb
|
143
|
-
- test/test_dragoon_system.rb
|
data/test/test_dragoon_system.rb
DELETED