textquery 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/VERSION +1 -1
- data/lib/textquery/textquery.rb +5 -2
- data/textquery.gemspec +56 -0
- metadata +4 -3
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/textquery/textquery.rb
CHANGED
@@ -50,6 +50,9 @@ end
|
|
50
50
|
|
51
51
|
Treetop.load File.dirname(__FILE__) + "/textquery_grammar"
|
52
52
|
|
53
|
+
class TextQueryError < RuntimeError
|
54
|
+
end
|
55
|
+
|
53
56
|
class TextQuery
|
54
57
|
def initialize(query = '', options = {})
|
55
58
|
@parser = TextQueryGrammarParser.new
|
@@ -63,7 +66,7 @@ class TextQuery
|
|
63
66
|
query = query.mb_chars if RUBY_VERSION < '1.9'
|
64
67
|
@query = @parser.parse(query)
|
65
68
|
if not @query
|
66
|
-
|
69
|
+
raise TextQueryError, "Could not parse query string '#{query}': #{@parser.terminal_failures.inspect}"
|
67
70
|
end
|
68
71
|
self
|
69
72
|
end
|
@@ -74,7 +77,7 @@ class TextQuery
|
|
74
77
|
if @query
|
75
78
|
@query.eval(input, @options)
|
76
79
|
else
|
77
|
-
|
80
|
+
raise TextQueryError, 'no query specified'
|
78
81
|
end
|
79
82
|
end
|
80
83
|
alias :match? :eval
|
data/textquery.gemspec
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{textquery}
|
8
|
+
s.version = "0.1.5"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ilya Grigorik"]
|
12
|
+
s.date = %q{2010-07-26}
|
13
|
+
s.description = %q{Evaluate any text against a collection of match rules}
|
14
|
+
s.email = %q{ilya@igvita.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"benchmark/benchmark.rb",
|
24
|
+
"benchmark/sample.txt",
|
25
|
+
"examples/web.rb",
|
26
|
+
"lib/textquery.rb",
|
27
|
+
"lib/textquery/textquery.rb",
|
28
|
+
"lib/textquery/textquery_grammar.treetop",
|
29
|
+
"spec/textquery_spec.rb",
|
30
|
+
"textquery.gemspec"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/igrigorik/textquery}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubyforge_project = %q{textquery}
|
36
|
+
s.rubygems_version = %q{1.3.6}
|
37
|
+
s.summary = %q{Evaluate any text against a collection of match rules}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/textquery_spec.rb",
|
40
|
+
"examples/web.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<treetop>, [">= 0"])
|
49
|
+
else
|
50
|
+
s.add_dependency(%q<treetop>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<treetop>, [">= 0"])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ilya Grigorik
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-26 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/textquery/textquery.rb
|
50
50
|
- lib/textquery/textquery_grammar.treetop
|
51
51
|
- spec/textquery_spec.rb
|
52
|
+
- textquery.gemspec
|
52
53
|
has_rdoc: true
|
53
54
|
homepage: http://github.com/igrigorik/textquery
|
54
55
|
licenses: []
|