Class: Fusuma::ActionStack

Inherits:
Array
  • Object
show all
Defined in:
lib/fusuma/action_stack.rb

Overview

manage actions

Defined Under Namespace

Classes: Direction, GestureInfo

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ActionStack

Returns a new instance of ActionStack.



4
5
6
# File 'lib/fusuma/action_stack.rb', line 4

def initialize(*args)
  super(*args)
end

Instance Method Details

#gesture_infoObject

return { finger:, direction:, action: } or nil



9
10
11
12
13
14
15
16
# File 'lib/fusuma/action_stack.rb', line 9

def gesture_info
  return unless enough_actions?
  direction = detect_direction
  finger    = detect_finger
  action    = detect_action
  clear
  GestureInfo.new(finger, direction, action)
end

#push(gesture_action) ⇒ Object Also known as: <<



18
19
20
21
# File 'lib/fusuma/action_stack.rb', line 18

def push(gesture_action)
  super(gesture_action)
  clear if action_end?
end