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
-
#initialize(move_x:, move_y:) ⇒ Quantity
constructor
A new instance of Quantity.
- #to_f ⇒ Object
Constructor Details
#initialize(move_x:, move_y:) ⇒ Quantity
Returns a new instance of Quantity.
160 161 162 163 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 160 def initialize(move_x:, move_y:) @x = move_x.to_f.abs @y = move_y.to_f.abs end |
Instance Method Details
#calc ⇒ Object
169 170 171 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 169 def calc (@x > @y) ? @x.abs : @y.abs end |
#to_f ⇒ Object
165 166 167 |
# File 'lib/fusuma/plugin/detectors/swipe_detector.rb', line 165 def to_f calc.to_f end |