Class: Switcher::Facade

Inherits:
Object
  • Object
show all
Defined in:
lib/switcher/facade.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, data) ⇒ Facade

Returns a new instance of Facade.



3
4
5
6
7
8
9
# File 'lib/switcher/facade.rb', line 3

def initialize(target, data)
  @args    = data
  @stopped = false
  @bubble_cancelled = false
  @target_state     = nil
  @target  = target
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



11
12
13
# File 'lib/switcher/facade.rb', line 11

def args
  @args
end

#bubble_cancelledObject (readonly)

Returns the value of attribute bubble_cancelled.



11
12
13
# File 'lib/switcher/facade.rb', line 11

def bubble_cancelled
  @bubble_cancelled
end

#stoppedObject (readonly)

Returns the value of attribute stopped.



11
12
13
# File 'lib/switcher/facade.rb', line 11

def stopped
  @stopped
end

#targetObject (readonly)

Returns the value of attribute target.



11
12
13
# File 'lib/switcher/facade.rb', line 11

def target
  @target
end

#target_stateObject (readonly)

Returns the value of attribute target_state.



11
12
13
# File 'lib/switcher/facade.rb', line 11

def target_state
  @target_state
end

Instance Method Details

#cancel_bubbleObject



24
25
26
# File 'lib/switcher/facade.rb', line 24

def cancel_bubble
  @bubble_cancelled = true
end

#stopObject Also known as: restrict



13
14
15
16
# File 'lib/switcher/facade.rb', line 13

def stop
  @stopped = true
  @bubble_cancelled = true
end

#switch_to(state) ⇒ Object



20
21
22
# File 'lib/switcher/facade.rb', line 20

def switch_to(state)
  @target_state = state.to_sym
end