rack-mount 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,33 +28,46 @@ module Rack::Mount
|
|
28
28
|
@min ||= values.min || 0
|
29
29
|
end
|
30
30
|
|
31
|
-
def mid_range
|
32
|
-
@mid_range ||= calculate_mid_range
|
33
|
-
end
|
34
|
-
|
35
31
|
def mean
|
36
32
|
@mean ||= calculate_mean
|
37
33
|
end
|
38
34
|
|
39
|
-
def
|
40
|
-
@
|
35
|
+
def standard_deviation
|
36
|
+
@standard_deviation ||= calculate_standard_deviation
|
41
37
|
end
|
42
38
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
def upper_quartile_limit
|
40
|
+
@upper_quartile_limit ||= calculate_upper_quartile_limit
|
41
|
+
end
|
42
|
+
|
43
|
+
def keys_in_upper_quartile
|
44
|
+
@keys_in_upper_quartile ||= compute_keys_in_upper_quartile
|
45
|
+
end
|
47
46
|
|
47
|
+
private
|
48
48
|
def calculate_mean
|
49
49
|
count / size
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
|
52
|
+
def calculate_variance
|
53
|
+
values.inject(0) { |sum, e| sum + (e - mean) ** 2 } / count.to_f
|
54
|
+
end
|
55
|
+
|
56
|
+
def calculate_standard_deviation
|
57
|
+
Math.sqrt(calculate_variance)
|
58
|
+
end
|
59
|
+
|
60
|
+
def calculate_upper_quartile_limit
|
61
|
+
mean + standard_deviation
|
62
|
+
end
|
63
|
+
|
64
|
+
def compute_keys_in_upper_quartile
|
65
|
+
sorted_by_frequency.select { |_, value| value >= upper_quartile_limit }.map! { |key, _| key }
|
54
66
|
end
|
55
67
|
|
56
68
|
def expire_caches!
|
57
|
-
@max = @min = @
|
69
|
+
@max = @min = @mean = @standard_deviation = nil
|
70
|
+
@keys_in_upper_quartile = nil
|
58
71
|
end
|
59
72
|
end
|
60
73
|
end
|
@@ -39,7 +39,7 @@ module Rack::Mount
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def separators(key)
|
42
|
-
@boundaries[key].
|
42
|
+
@boundaries[key].keys_in_upper_quartile
|
43
43
|
end
|
44
44
|
|
45
45
|
def process_key(requirements, method, requirement)
|
@@ -144,8 +144,6 @@ module Rack::Mount
|
|
144
144
|
segments.pop
|
145
145
|
end
|
146
146
|
|
147
|
-
segments.shift if segments[0].nil? || segments[0] == ''
|
148
|
-
|
149
147
|
segments
|
150
148
|
end
|
151
149
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-mount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Peek
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-17 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +71,8 @@ files:
|
|
71
71
|
- LICENSE
|
72
72
|
has_rdoc: true
|
73
73
|
homepage: http://github.com/josh/rack-mount
|
74
|
+
licenses: []
|
75
|
+
|
74
76
|
post_install_message:
|
75
77
|
rdoc_options: []
|
76
78
|
|
@@ -91,9 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
requirements: []
|
92
94
|
|
93
95
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.3.
|
96
|
+
rubygems_version: 1.3.5
|
95
97
|
signing_key:
|
96
|
-
specification_version:
|
98
|
+
specification_version: 3
|
97
99
|
summary: Stackable dynamic tree based Rack router
|
98
100
|
test_files: []
|
99
101
|
|