Class: Fusuma::Pinch
- Inherits:
-
Object
- Object
- Fusuma::Pinch
- Defined in:
- lib/fusuma/pinch.rb
Overview
vector data
Constant Summary collapse
- BASE_THERESHOLD =
0.3
- BASE_INTERVAL =
0.05
Class Attribute Summary collapse
-
.last_time ⇒ Object
readonly
Returns the value of attribute last_time.
Instance Attribute Summary collapse
-
#diameter ⇒ Object
readonly
Returns the value of attribute diameter.
Class Method Summary collapse
Instance Method Summary collapse
- #direction ⇒ Object
- #enough? ⇒ Boolean
-
#initialize(diameter) ⇒ Pinch
constructor
A new instance of Pinch.
Constructor Details
#initialize(diameter) ⇒ Pinch
Returns a new instance of Pinch.
7 8 9 |
# File 'lib/fusuma/pinch.rb', line 7 def initialize(diameter) @diameter = diameter.to_f end |
Class Attribute Details
.last_time ⇒ Object (readonly)
Returns the value of attribute last_time.
48 49 50 |
# File 'lib/fusuma/pinch.rb', line 48 def last_time @last_time end |
Instance Attribute Details
#diameter ⇒ Object (readonly)
Returns the value of attribute diameter.
11 12 13 |
# File 'lib/fusuma/pinch.rb', line 11 def diameter @diameter end |
Class Method Details
.touch_last_time ⇒ Object
50 51 52 |
# File 'lib/fusuma/pinch.rb', line 50 def touch_last_time @last_time = Time.now end |
Instance Method Details
#direction ⇒ Object
13 14 15 16 |
# File 'lib/fusuma/pinch.rb', line 13 def direction return 'in' if diameter > 0 'out' end |
#enough? ⇒ Boolean
18 19 20 21 |
# File 'lib/fusuma/pinch.rb', line 18 def enough? MultiLogger.debug(diameter: diameter) enough_diameter? && enough_interval? && self.class.touch_last_time end |