metry 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +14 -69
- data/TODO +2 -3
- data/cucumber.yml +1 -0
- data/example/example.rb +1 -1
- data/features/psycho/dashboard.feature +17 -0
- data/features/psycho/goals.feature +24 -0
- data/features/psycho/visitor_tracking.feature +32 -0
- data/features/step_definitions/goals.rb +3 -0
- data/features/step_definitions/tracking.rb +1 -1
- data/features/step_definitions/web.rb +14 -2
- data/features/support/env.rb +4 -0
- data/lib/metry.rb +4 -6
- data/lib/metry/experiment.rb +6 -8
- data/lib/metry/psycho.rb +112 -0
- data/lib/metry/psycho/dashboard.erb +14 -0
- data/lib/metry/psycho/layout.erb +8 -0
- data/lib/metry/psycho/new_goal.erb +9 -0
- data/lib/metry/psycho/visitor.erb +7 -0
- data/lib/metry/rack/tracking.rb +17 -13
- data/lib/metry/storage.rb +116 -0
- data/radiant/example/features/metry.feature +8 -8
- data/radiant/example/features/psycho.feature +13 -0
- data/radiant/example/features/step_definitions/experiments.rb +2 -2
- data/radiant/example/features/step_definitions/tracking.rb +1 -1
- data/radiant/example/features/support/env.rb +3 -0
- data/radiant/extension/lib/metry_authenticator.rb +30 -0
- data/radiant/extension/lib/metry_tags.rb +2 -1
- data/radiant/extension/metry_extension.rb +1 -1
- data/test/{test_tokyo.rb → test_storage.rb} +3 -3
- metadata +17 -72
- data/lib/metry/memory.rb +0 -27
- data/lib/metry/tokyo.rb +0 -181
- data/vendor/rufus-tokyo/CHANGELOG.txt +0 -112
- data/vendor/rufus-tokyo/CREDITS.txt +0 -27
- data/vendor/rufus-tokyo/LICENSE.txt +0 -21
- data/vendor/rufus-tokyo/README.txt +0 -310
- data/vendor/rufus-tokyo/Rakefile +0 -118
- data/vendor/rufus-tokyo/TODO.txt +0 -25
- data/vendor/rufus-tokyo/doc/decision_table.numbers +0 -0
- data/vendor/rufus-tokyo/doc/rdoc-style.css +0 -320
- data/vendor/rufus-tokyo/lib/rufus-edo.rb +0 -3
- data/vendor/rufus-tokyo/lib/rufus-tokyo.rb +0 -3
- data/vendor/rufus-tokyo/lib/rufus/edo.rb +0 -39
- data/vendor/rufus-tokyo/lib/rufus/edo/README.txt +0 -106
- data/vendor/rufus-tokyo/lib/rufus/edo/cabcore.rb +0 -333
- data/vendor/rufus-tokyo/lib/rufus/edo/cabinet/abstract.rb +0 -219
- data/vendor/rufus-tokyo/lib/rufus/edo/cabinet/table.rb +0 -159
- data/vendor/rufus-tokyo/lib/rufus/edo/error.rb +0 -36
- data/vendor/rufus-tokyo/lib/rufus/edo/ntyrant.rb +0 -4
- data/vendor/rufus-tokyo/lib/rufus/edo/ntyrant/abstract.rb +0 -137
- data/vendor/rufus-tokyo/lib/rufus/edo/ntyrant/table.rb +0 -141
- data/vendor/rufus-tokyo/lib/rufus/edo/tabcore.rb +0 -567
- data/vendor/rufus-tokyo/lib/rufus/tokyo.rb +0 -58
- data/vendor/rufus-tokyo/lib/rufus/tokyo/cabinet/abstract.rb +0 -568
- data/vendor/rufus-tokyo/lib/rufus/tokyo/cabinet/lib.rb +0 -230
- data/vendor/rufus-tokyo/lib/rufus/tokyo/cabinet/table.rb +0 -753
- data/vendor/rufus-tokyo/lib/rufus/tokyo/cabinet/util.rb +0 -425
- data/vendor/rufus-tokyo/lib/rufus/tokyo/config.rb +0 -161
- data/vendor/rufus-tokyo/lib/rufus/tokyo/dystopia.rb +0 -43
- data/vendor/rufus-tokyo/lib/rufus/tokyo/dystopia/lib.rb +0 -65
- data/vendor/rufus-tokyo/lib/rufus/tokyo/dystopia/words.rb +0 -71
- data/vendor/rufus-tokyo/lib/rufus/tokyo/hmethods.rb +0 -111
- data/vendor/rufus-tokyo/lib/rufus/tokyo/query.rb +0 -102
- data/vendor/rufus-tokyo/lib/rufus/tokyo/transactions.rb +0 -74
- data/vendor/rufus-tokyo/lib/rufus/tokyo/ttcommons.rb +0 -59
- data/vendor/rufus-tokyo/lib/rufus/tokyo/tyrant.rb +0 -35
- data/vendor/rufus-tokyo/lib/rufus/tokyo/tyrant/abstract.rb +0 -146
- data/vendor/rufus-tokyo/lib/rufus/tokyo/tyrant/lib.rb +0 -153
- data/vendor/rufus-tokyo/lib/rufus/tokyo/tyrant/table.rb +0 -162
- data/vendor/rufus-tokyo/rufus-tokyo.gemspec +0 -25
- data/vendor/rufus-tokyo/spec/cabinet_spec.rb +0 -472
- data/vendor/rufus-tokyo/spec/cabinetconfig_spec.rb +0 -82
- data/vendor/rufus-tokyo/spec/edo_cabinet_spec.rb +0 -447
- data/vendor/rufus-tokyo/spec/edo_ntyrant_spec.rb +0 -299
- data/vendor/rufus-tokyo/spec/edo_ntyrant_table_spec.rb +0 -462
- data/vendor/rufus-tokyo/spec/edo_table_spec.rb +0 -560
- data/vendor/rufus-tokyo/spec/hmethods_spec.rb +0 -44
- data/vendor/rufus-tokyo/spec/incr.lua +0 -20
- data/vendor/rufus-tokyo/spec/spec.rb +0 -9
- data/vendor/rufus-tokyo/spec/spec_base.rb +0 -23
- data/vendor/rufus-tokyo/spec/start_tyrants.sh +0 -26
- data/vendor/rufus-tokyo/spec/stop_tyrants.sh +0 -9
- data/vendor/rufus-tokyo/spec/table_spec.rb +0 -567
- data/vendor/rufus-tokyo/spec/tyrant_spec.rb +0 -309
- data/vendor/rufus-tokyo/spec/tyrant_table_spec.rb +0 -479
- data/vendor/rufus-tokyo/spec/util_list_spec.rb +0 -200
- data/vendor/rufus-tokyo/spec/util_map_spec.rb +0 -132
- data/vendor/rufus-tokyo/tasks/dev.rb +0 -70
- data/vendor/rufus-tokyo/test/bm0.rb +0 -353
- data/vendor/rufus-tokyo/test/bm1_compression.rb +0 -54
- data/vendor/rufus-tokyo/test/con0.rb +0 -30
- data/vendor/rufus-tokyo/test/mem.rb +0 -49
- data/vendor/rufus-tokyo/test/mem1.rb +0 -44
- data/vendor/rufus-tokyo/test/readme0.rb +0 -17
- data/vendor/rufus-tokyo/test/readme1.rb +0 -21
- data/vendor/rufus-tokyo/test/readme2.rb +0 -15
- data/vendor/rufus-tokyo/test/readme3.rb +0 -24
- data/vendor/rufus-tokyo/test/readmes_test.sh +0 -17
@@ -1,43 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
require 'rufus/tokyo'
|
27
|
-
|
28
|
-
|
29
|
-
module Rufus::Tokyo
|
30
|
-
|
31
|
-
#
|
32
|
-
# An error for Dystopia
|
33
|
-
#
|
34
|
-
class DystopianError < RuntimeError
|
35
|
-
def new (error_code)
|
36
|
-
super("tokyo dystopia error #{error_code}")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
require 'rufus/tokyo/dystopia/lib'
|
42
|
-
require 'rufus/tokyo/dystopia/words'
|
43
|
-
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus::Tokyo
|
27
|
-
|
28
|
-
#
|
29
|
-
# The libtokyodystopia.so methods get bound to this module
|
30
|
-
#
|
31
|
-
module DystopiaLib #:nodoc#
|
32
|
-
|
33
|
-
extend FFI::Library
|
34
|
-
|
35
|
-
#
|
36
|
-
# find Tokyo Dystopia lib
|
37
|
-
|
38
|
-
paths = Array(ENV['TOKYO_DYSTOPIA_LIB'] || %w{
|
39
|
-
/opt/local/lib/libtokyodystopia.dylib
|
40
|
-
/usr/local/lib/libtokyodystopia.dylib
|
41
|
-
/usr/local/lib/libtokyodystopia.so
|
42
|
-
})
|
43
|
-
|
44
|
-
if path = paths.find { |path| File.exist?(path) }
|
45
|
-
|
46
|
-
raise "did not find Tokyo Dystopia libs on your system" unless path
|
47
|
-
|
48
|
-
ffi_lib(path)
|
49
|
-
|
50
|
-
#
|
51
|
-
# tcwdb functions
|
52
|
-
#
|
53
|
-
# http://tokyocabinet.sourceforge.net/dystopiadoc/#tcwdbapi
|
54
|
-
|
55
|
-
attach_function :tcwdbnew, [], :pointer
|
56
|
-
|
57
|
-
attach_function :tcwdbopen, [ :pointer, :string, :int ], :int
|
58
|
-
attach_function :tcwdbclose, [ :pointer ], :int
|
59
|
-
|
60
|
-
attach_function :tcwdbecode, [ :pointer ], :int
|
61
|
-
|
62
|
-
attach_function :tcwdbput2, [ :pointer, :int64, :string, :string ], :pointer
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
@@ -1,71 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus::Tokyo
|
27
|
-
|
28
|
-
#
|
29
|
-
# Tokyo Dystopia words database.
|
30
|
-
#
|
31
|
-
# http://tokyocabinet.sourceforge.net/dystopiadoc/
|
32
|
-
#
|
33
|
-
class Words
|
34
|
-
|
35
|
-
#
|
36
|
-
# TODO : continue me
|
37
|
-
#
|
38
|
-
|
39
|
-
#
|
40
|
-
# Opens/create a Tokyo Dystopia words database.
|
41
|
-
#
|
42
|
-
def initialize (path, opts={})
|
43
|
-
|
44
|
-
# tcwdb.h :
|
45
|
-
#
|
46
|
-
# enum { /* enumeration for open modes */
|
47
|
-
# WDBOREADER = 1 << 0, /* open as a reader */
|
48
|
-
# WDBOWRITER = 1 << 1, /* open as a writer */
|
49
|
-
# WDBOCREAT = 1 << 2, /* writer creating */
|
50
|
-
# WDBOTRUNC = 1 << 3, /* writer truncating */
|
51
|
-
# WDBONOLCK = 1 << 4, /* open without locking */
|
52
|
-
# WDBOLCKNB = 1 << 5 /* lock without blocking */
|
53
|
-
# };
|
54
|
-
|
55
|
-
mode = 0
|
56
|
-
|
57
|
-
@db = dlib.tcwdbnew
|
58
|
-
|
59
|
-
(dlib.tcwdbopen(@db, path, mode) == 1) || raise_error
|
60
|
-
end
|
61
|
-
|
62
|
-
protected
|
63
|
-
|
64
|
-
#
|
65
|
-
# Raises a dystopian error (asks the db which one)
|
66
|
-
#
|
67
|
-
def raise_error
|
68
|
-
raise DystopianError.new(dlib.tcwdbecode(@db))
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus
|
27
|
-
module Tokyo
|
28
|
-
|
29
|
-
#
|
30
|
-
# A mixin for Cabinet and Map, gathers all the hash-like methods
|
31
|
-
#
|
32
|
-
module HashMethods
|
33
|
-
|
34
|
-
include Enumerable
|
35
|
-
|
36
|
-
# The [] methods
|
37
|
-
#
|
38
|
-
# (assumes there's an underlying get(k) method)
|
39
|
-
#
|
40
|
-
def [] (k)
|
41
|
-
|
42
|
-
val = get(k)
|
43
|
-
|
44
|
-
return val unless val.nil?
|
45
|
-
return nil unless @default_proc
|
46
|
-
|
47
|
-
@default_proc.call(self, k)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Returns an array of all the values
|
51
|
-
#
|
52
|
-
def values
|
53
|
-
|
54
|
-
collect { |k, v| v }
|
55
|
-
end
|
56
|
-
|
57
|
-
# Our classical 'each'
|
58
|
-
#
|
59
|
-
def each
|
60
|
-
|
61
|
-
keys.each { |k| yield(k, self[k]) }
|
62
|
-
end
|
63
|
-
|
64
|
-
# Turns this instance into a Ruby hash
|
65
|
-
#
|
66
|
-
def to_h
|
67
|
-
|
68
|
-
self.inject({}) { |h, (k, v)| h[k] = v; h }
|
69
|
-
end
|
70
|
-
|
71
|
-
# Turns this instance into an array of [ key, value ]
|
72
|
-
#
|
73
|
-
def to_a
|
74
|
-
|
75
|
-
self.collect { |e| e }
|
76
|
-
end
|
77
|
-
|
78
|
-
# Returns a new Ruby hash which is a merge of this Map and the given hash
|
79
|
-
#
|
80
|
-
def merge (h)
|
81
|
-
|
82
|
-
self.to_h.merge(h)
|
83
|
-
end
|
84
|
-
|
85
|
-
# Merges the entries in the given hash into this map
|
86
|
-
#
|
87
|
-
def merge! (h)
|
88
|
-
|
89
|
-
h.each { |k, v| self[k] = v }
|
90
|
-
|
91
|
-
self
|
92
|
-
end
|
93
|
-
|
94
|
-
def default (key=nil)
|
95
|
-
|
96
|
-
val = self[key]
|
97
|
-
|
98
|
-
val.nil? ? @default_proc.call(self, key) : val
|
99
|
-
end
|
100
|
-
|
101
|
-
def default= (val)
|
102
|
-
|
103
|
-
@default_proc = lambda { |h, k| val }
|
104
|
-
end
|
105
|
-
|
106
|
-
attr_reader :default_proc
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
@@ -1,102 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus
|
27
|
-
module Tokyo
|
28
|
-
|
29
|
-
#
|
30
|
-
# Some constants shared by table implementations.
|
31
|
-
#
|
32
|
-
module QueryConstants
|
33
|
-
|
34
|
-
OPERATORS = {
|
35
|
-
|
36
|
-
# strings...
|
37
|
-
|
38
|
-
:streq => 0, # string equality
|
39
|
-
:eq => 0,
|
40
|
-
:eql => 0,
|
41
|
-
:equals => 0,
|
42
|
-
|
43
|
-
:strinc => 1, # string include
|
44
|
-
:inc => 1, # string include
|
45
|
-
:includes => 1, # string include
|
46
|
-
|
47
|
-
:strbw => 2, # string begins with
|
48
|
-
:bw => 2,
|
49
|
-
:starts_with => 2,
|
50
|
-
:strew => 3, # string ends with
|
51
|
-
:ew => 3,
|
52
|
-
:ends_with => 3,
|
53
|
-
|
54
|
-
:strand => 4, # string which include all the tokens in the given exp
|
55
|
-
:and => 4,
|
56
|
-
|
57
|
-
:stror => 5, # string which include at least one of the tokens
|
58
|
-
:or => 5,
|
59
|
-
|
60
|
-
:stroreq => 6, # string which is equal to at least one token
|
61
|
-
|
62
|
-
:strorrx => 7, # string which matches the given regex
|
63
|
-
:regex => 7,
|
64
|
-
:matches => 7,
|
65
|
-
|
66
|
-
# numbers...
|
67
|
-
|
68
|
-
:numeq => 8, # equal
|
69
|
-
:numequals => 8,
|
70
|
-
:numgt => 9, # greater than
|
71
|
-
:gt => 9,
|
72
|
-
:numge => 10, # greater or equal
|
73
|
-
:ge => 10,
|
74
|
-
:gte => 10,
|
75
|
-
:numlt => 11, # greater or equal
|
76
|
-
:lt => 11,
|
77
|
-
:numle => 12, # greater or equal
|
78
|
-
:le => 12,
|
79
|
-
:lte => 12,
|
80
|
-
:numbt => 13, # a number between two tokens in the given exp
|
81
|
-
:bt => 13,
|
82
|
-
:between => 13,
|
83
|
-
|
84
|
-
:numoreq => 14 # number which is equal to at least one token
|
85
|
-
}
|
86
|
-
|
87
|
-
TDBQCNEGATE = 1 << 24
|
88
|
-
TDBQCNOIDX = 1 << 25
|
89
|
-
|
90
|
-
DIRECTIONS = {
|
91
|
-
:strasc => 0,
|
92
|
-
:strdesc => 1,
|
93
|
-
:asc => 0,
|
94
|
-
:desc => 1,
|
95
|
-
:numasc => 2,
|
96
|
-
:numdesc => 3
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2009, John Mettraux, jmettraux@gmail.com
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#
|
22
|
-
# Made in Japan.
|
23
|
-
#++
|
24
|
-
|
25
|
-
|
26
|
-
module Rufus
|
27
|
-
module Tokyo
|
28
|
-
|
29
|
-
#
|
30
|
-
# A mixin for structures to respond to tranbegin, trancommit and tranabort
|
31
|
-
#
|
32
|
-
module Transactions
|
33
|
-
|
34
|
-
#
|
35
|
-
# Transaction in a block.
|
36
|
-
#
|
37
|
-
# table.transaction do
|
38
|
-
# table['pk0'] => { 'name' => 'Fred', 'age' => '40' }
|
39
|
-
# table['pk1'] => { 'name' => 'Brooke', 'age' => '76' }
|
40
|
-
# table.abort if weather.bad?
|
41
|
-
# end
|
42
|
-
#
|
43
|
-
# (This is a table example, a classical cabinet won't accept a hash
|
44
|
-
# as a value for its entries).
|
45
|
-
#
|
46
|
-
# If an error or an abort is trigger withing the transaction, it's rolled
|
47
|
-
# back. If the block executes successfully, it gets commited.
|
48
|
-
#
|
49
|
-
def transaction
|
50
|
-
|
51
|
-
return unless block_given?
|
52
|
-
|
53
|
-
begin
|
54
|
-
tranbegin
|
55
|
-
yield
|
56
|
-
trancommit
|
57
|
-
rescue Exception => e
|
58
|
-
tranabort
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Aborts the enclosing transaction
|
64
|
-
#
|
65
|
-
# See #transaction
|
66
|
-
#
|
67
|
-
def abort
|
68
|
-
raise "abort transaction !"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|