Class: RolloutUi::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rollout_ui/wrapper.rb

Defined Under Namespace

Classes: NoRolloutInstance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rollout = nil) ⇒ Wrapper

Returns a new instance of Wrapper.

Raises:



7
8
9
10
# File 'lib/rollout_ui/wrapper.rb', line 7

def initialize(rollout = nil)
  @rollout = rollout || RolloutUi.rollout
  raise NoRolloutInstance unless @rollout
end

Instance Attribute Details

#rolloutObject (readonly)

Returns the value of attribute rollout.



5
6
7
# File 'lib/rollout_ui/wrapper.rb', line 5

def rollout
  @rollout
end

Instance Method Details

#add_feature(feature) ⇒ Object



16
17
18
# File 'lib/rollout_ui/wrapper.rb', line 16

def add_feature(feature)
  redis.sadd(:features, feature)
end

#featuresObject



20
21
22
# File 'lib/rollout_ui/wrapper.rb', line 20

def features
  redis.smembers(:features)
end

#groupsObject



12
13
14
# File 'lib/rollout_ui/wrapper.rb', line 12

def groups
  rollout.instance_variable_get("@groups").keys
end

#redisObject



24
25
26
# File 'lib/rollout_ui/wrapper.rb', line 24

def redis
  rollout.instance_variable_get("@redis")
end