Class: Fusuma::Plugin::Detectors::PinchDetector::Quantity
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Detectors::PinchDetector::Quantity
- Defined in:
- lib/fusuma/plugin/detectors/pinch_detector.rb
Overview
quantity of gesture
Instance Method Summary collapse
- #calc ⇒ Object
-
#initialize(target:, base:) ⇒ Quantity
constructor
A new instance of Quantity.
- #to_f ⇒ Object
Constructor Details
#initialize(target:, base:) ⇒ Quantity
Returns a new instance of Quantity.
173 174 175 176 |
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 173 def initialize(target:, base:) @target = target.to_f @base = base.to_f end |
Instance Method Details
#calc ⇒ Object
182 183 184 185 186 187 188 |
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 182 def calc if @target > @base @target / @base else @base / @target end end |
#to_f ⇒ Object
178 179 180 |
# File 'lib/fusuma/plugin/detectors/pinch_detector.rb', line 178 def to_f calc.to_f end |