Class: Rack::Mount::Analysis::Splitting
Defined Under Namespace
Classes: Key
Constant Summary
collapse
- NULL =
"\0".freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Frequency
#expire!, #initialize, #possible_keys, #report
Instance Attribute Details
#separators(key) ⇒ Object
41
42
43
44
|
# File 'lib/rack/mount/analysis/splitting.rb', line 41
def separators(key)
@separators ||= {}
@separators[key] ||= lookup_separators(key)
end
|
Instance Method Details
#<<(key) ⇒ Object
34
35
36
37
38
39
|
# File 'lib/rack/mount/analysis/splitting.rb', line 34
def <<(key)
super
key.each_pair do |k, v|
analyze_capture_boundaries(v, @boundaries[k] ||= Histogram.new)
end
end
|
#clear ⇒ Object
29
30
31
32
|
# File 'lib/rack/mount/analysis/splitting.rb', line 29
def clear
@boundaries = {}
super
end
|
#lookup_separators(key) ⇒ Object
47
48
49
|
# File 'lib/rack/mount/analysis/splitting.rb', line 47
def lookup_separators(key)
@boundaries[key].keys_in_upper_quartile
end
|
#process_key(requirements, method, requirement) ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/rack/mount/analysis/splitting.rb', line 51
def process_key(requirements, method, requirement)
separators = separators(method)
if requirement.is_a?(Regexp) && separators.any?
generate_split_keys(requirement, separators).each_with_index do |value, index|
requirements[Key.new(method, index, Regexp.union(*separators))] = value
end
else
super
end
end
|