Class: Fusuma::Plugin::Detectors::RotateDetector::Direction

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/detectors/rotate_detector.rb

Overview

direction of gesture

Constant Summary collapse

CLOCKWISE =
'clockwise'
COUNTERCLOCKWISE =
'counterclockwise'

Instance Method Summary collapse

Constructor Details

#initialize(angle:) ⇒ Direction

Returns a new instance of Direction.



139
140
141
# File 'lib/fusuma/plugin/detectors/rotate_detector.rb', line 139

def initialize(angle:)
  @angle = angle.to_f
end

Instance Method Details

#calcObject



147
148
149
150
151
152
153
# File 'lib/fusuma/plugin/detectors/rotate_detector.rb', line 147

def calc
  if @angle.positive?
    CLOCKWISE
  else
    COUNTERCLOCKWISE
  end
end

#to_sObject



143
144
145
# File 'lib/fusuma/plugin/detectors/rotate_detector.rb', line 143

def to_s
  calc
end