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
10
# File 'lib/switcher/facade.rb', line 3

def initialize(target, data)
  @args    = data
  @stopped = false
  @target  = target

  @bubble_cancelled = false
  @target_state     = nil
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



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

def args
  @args
end

#bubble_cancelledObject (readonly)

Returns the value of attribute bubble_cancelled.



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

def bubble_cancelled
  @bubble_cancelled
end

#stoppedObject (readonly)

Returns the value of attribute stopped.



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

def stopped
  @stopped
end

#targetObject (readonly)

Returns the value of attribute target.



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

def target
  @target
end

#target_stateObject (readonly)

Returns the value of attribute target_state.



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

def target_state
  @target_state
end

Instance Method Details

#cancel_bubbleObject



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

def cancel_bubble
  @bubble_cancelled = true
end

#stopObject Also known as: restrict



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

def stop
  @stopped = true
  @bubble_cancelled = true
end

#switch_to(state) ⇒ Object



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

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