Class: Fusuma::ActionStack
- Inherits:
-
Array
- Object
- Array
- Fusuma::ActionStack
- Defined in:
- lib/fusuma/action_stack.rb
Overview
manage actions
Defined Under Namespace
Classes: Direction, GestureInfo
Instance Method Summary collapse
-
#gesture_info ⇒ Object
return { finger:, direction:, action: } or nil.
-
#initialize(*args) ⇒ ActionStack
constructor
A new instance of ActionStack.
- #push(gesture_action) ⇒ Object (also: #<<)
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_info ⇒ Object
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 |