Class: Fusuma::Plugin::Detectors::SwipeDetector::Quantity
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Detectors::SwipeDetector::Quantity
- Defined in:
- lib/fusuma/plugin/detectors/swipe_detector.rb
Overview
quantity of gesture
Instance Method Summary collapse
-
#calc ⇒ Object
: () -> Float.
-
#initialize(move_x:, move_y:) ⇒ Quantity
constructor
: (move_x: Integer | Float, move_y: Integer | Float) -> void.
-
#to_f ⇒ Object
: () -> Float.
Constructor Details
#initialize(move_x:, move_y:) ⇒ Quantity
: (move_x: Integer | Float, move_y: Integer | Float) -> void
170 171 172 173 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 170 def initialize(move_x:, move_y:) @x = move_x.to_f.abs @y = move_y.to_f.abs end |
Instance Method Details
#calc ⇒ Object
: () -> Float
181 182 183 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 181 def calc (@x > @y) ? @x.abs : @y.abs end |
#to_f ⇒ Object
: () -> Float
176 177 178 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 176 def to_f calc.to_f end |