push
github
0 of 8 new or added lines in 8 files covered. (0.0%)
2169 existing lines in 58 files now uncovered.0 of 2253 relevant lines covered (0.0%)
0.0 hits per line
UNCOV
1
|
module Unleash |
× |
UNCOV
2
|
class ActivationStrategy |
× |
UNCOV
3
|
attr_accessor :name, :params, :constraints, :disabled |
× |
4 |
|
|
UNCOV
5
|
def initialize(name, params, constraints = []) |
× |
UNCOV
6
|
self.name = name
|
× |
UNCOV
7
|
self.disabled = false |
× |
8 |
|
|
UNCOV
9
|
if params.is_a?(Hash) |
× |
UNCOV
10
|
self.params = params
|
× |
11 |
elsif params.nil?
|
|
UNCOV
12
|
self.params = {}
|
× |
13 |
else
|
|
UNCOV
14
|
Unleash.logger.warn "Invalid params provided for ActivationStrategy (params:#{params})" |
× |
UNCOV
15
|
self.params = {}
|
× |
16 |
end
|
|
17 |
|
|
UNCOV
18
|
if constraints.is_a?(Array) && constraints.each{ |c| c.is_a?(Constraint) } |
× |
UNCOV
19
|
self.constraints = constraints
|
× |
20 |
else
|
|
UNCOV
21
|
Unleash.logger.warn "Invalid constraints provided for ActivationStrategy (contraints: #{constraints})" |
× |
UNCOV
22
|
self.disabled = true |
× |
UNCOV
23
|
self.constraints = []
|
× |
24 |
end
|
|
25 |
end
|
|
26 |
|
|
UNCOV
27
|
def matches_context?(context) |
× |
28 |
self.constraints.any?{ |c| c.matches_context? context }
|
× |
29 |
end
|
|
30 |
end
|
|
31 |
end
|