keyword_search 1.3.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/{Manifest.txt → Manifest} +5 -5
- data/README.markdown +125 -0
- data/Rakefile +27 -12
- data/VERSION +1 -0
- data/keyword_search.gemspec +49 -0
- data/lib/keyword_search.rb +1107 -73
- data/lib/keyword_search.rl +41 -14
- data/lib/keyword_search/definition.rb +16 -5
- data/test/test_keyword_search.rb +162 -34
- metadata +51 -48
- data/README.txt +0 -91
metadata
CHANGED
@@ -1,64 +1,67 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: keyword_search
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date: 2007-10-09 00:00:00 -05:00
|
8
|
-
summary: Generic support for extracting GMail-style search keywords/values from strings
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: bruce@codefluency.com
|
12
|
-
homepage: " http://codefluency.rubyforge.org/keyword_search"
|
13
|
-
rubyforge_project: codefluency
|
14
|
-
description: "== FEATURES: The library features a very simple, easy-to-use API. * Define handlers for supported keywords with blocks * Define the default keyword (values not part of a keyword/value pair) Development Roadmap: 2.0:: Add negation and grouping (will break API backwards compatibility) Note:: As of 1.3.0, input to KeywordSearch.search is no longer automatically downcased, allowing for case sensitive keyword and value pairs. If you want case insensitivity, downcase the input before you invoke the method. == SYNOPSIS:"
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.4.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Bruce Williams
|
8
|
+
- Eric Lindvall
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-10-22 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description:
|
18
|
+
email:
|
19
|
+
- bruce@codefluency.com
|
20
|
+
- eric@sevenscale.com
|
21
|
+
executables: []
|
22
|
+
|
23
|
+
extensions: []
|
24
|
+
|
25
|
+
extra_rdoc_files:
|
26
|
+
- README.markdown
|
31
27
|
files:
|
32
28
|
- History.txt
|
33
|
-
- Manifest
|
34
|
-
- README.
|
29
|
+
- Manifest
|
30
|
+
- README.markdown
|
35
31
|
- Rakefile
|
32
|
+
- VERSION
|
33
|
+
- keyword_search.gemspec
|
36
34
|
- lib/keyword_search.rb
|
37
35
|
- lib/keyword_search.rl
|
38
36
|
- lib/keyword_search/definition.rb
|
39
37
|
- test/test_keyword_search.rb
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- --main
|
44
|
-
- README.txt
|
45
|
-
extra_rdoc_files:
|
46
|
-
- History.txt
|
47
|
-
- Manifest.txt
|
48
|
-
- README.txt
|
49
|
-
executables: []
|
50
|
-
|
51
|
-
extensions: []
|
38
|
+
has_rdoc: true
|
39
|
+
homepage: http://github.com/bruce/keyword_search
|
40
|
+
licenses: []
|
52
41
|
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options:
|
44
|
+
- --charset=UTF-8
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
53
59
|
requirements: []
|
54
60
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 1.3.0
|
64
|
-
version:
|
61
|
+
rubyforge_project: codefluency
|
62
|
+
rubygems_version: 1.3.5
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Generic library to parse GMail-style search strings for keyword/value pairs; supports definition of valid keywords and handling of quoted values.
|
66
|
+
test_files:
|
67
|
+
- test/test_keyword_search.rb
|
data/README.txt
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
keyword_search
|
2
|
-
http://codefluency.rubyforge.org/keyword_search
|
3
|
-
by Bruce Williams
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
Generic library to parse GMail-style search strings for keyword/value pairs; supports definition of valid keywords and handling of quoted values.
|
8
|
-
|
9
|
-
== FEATURES:
|
10
|
-
|
11
|
-
The library features a very simple, easy-to-use API.
|
12
|
-
* Define handlers for supported keywords with blocks
|
13
|
-
* Define the default keyword (values not part of a keyword/value pair)
|
14
|
-
|
15
|
-
Development Roadmap:
|
16
|
-
2.0:: Add negation and grouping (will break API backwards compatibility)
|
17
|
-
|
18
|
-
Note:: As of 1.3.0, input to KeywordSearch.search is no longer automatically downcased, allowing for case sensitive keyword and value pairs. If you want case insensitivity, downcase the input before you invoke the method.
|
19
|
-
|
20
|
-
== SYNOPSIS:
|
21
|
-
|
22
|
-
Here's an example of usage from Rails (though the library is generic, and could presumably be used for any Ruby project)
|
23
|
-
|
24
|
-
# Some variables to build up
|
25
|
-
clauses = []
|
26
|
-
arguments = []
|
27
|
-
|
28
|
-
# Search a string, defining the supported keywords and building up
|
29
|
-
# the variables in the associated closures
|
30
|
-
|
31
|
-
KeywordSearch.search('account has:attachment since:2006-12-03') do |with|
|
32
|
-
|
33
|
-
with.default_keyword :title
|
34
|
-
|
35
|
-
with.keyword :title do |values|
|
36
|
-
clauses << "title like ?"
|
37
|
-
arguments << "%#{values.join(' ')}%"
|
38
|
-
end
|
39
|
-
|
40
|
-
with.keyword :has do |values|
|
41
|
-
clauses << 'has_attachment = true' if values.include?('attachment')
|
42
|
-
end
|
43
|
-
|
44
|
-
with.keyword :since do |values|
|
45
|
-
date = Date.parse(values.first) # only support one
|
46
|
-
clauses << 'created_on >= ?'
|
47
|
-
arguments << date.to_s
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
# Do our search with <tt>clauses</tt> and <tt>arguments</tt>
|
53
|
-
conditions = [clauses.map{|c| "(#{c})"}.join(' AND ')), *arguments] # simplistic example
|
54
|
-
results = Message.find(:all, :conditions => conditions)
|
55
|
-
|
56
|
-
== REQUIREMENTS:
|
57
|
-
|
58
|
-
* hoe
|
59
|
-
|
60
|
-
== INSTALL:
|
61
|
-
|
62
|
-
sudo gem install keyword_search
|
63
|
-
|
64
|
-
== LICENSE:
|
65
|
-
|
66
|
-
(The MIT License)
|
67
|
-
|
68
|
-
Copyright (c) 2007 Bruce Williams
|
69
|
-
|
70
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
71
|
-
a copy of this software and associated documentation files (the
|
72
|
-
'Software'), to deal in the Software without restriction, including
|
73
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
74
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
75
|
-
permit persons to whom the Software is furnished to do so, subject to
|
76
|
-
the following conditions:
|
77
|
-
|
78
|
-
The above copyright notice and this permission notice shall be
|
79
|
-
included in all copies or substantial portions of the Software.
|
80
|
-
|
81
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
82
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
83
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
84
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
85
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
86
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
87
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
88
|
-
|
89
|
-
== LEGAL NOTES
|
90
|
-
|
91
|
-
GMail is copyright Google, Inc.
|