Class: Fusuma::Plugin::Events::Records::TouchRecord
- Inherits:
-
Record
- Object
- Record
- Fusuma::Plugin::Events::Records::TouchRecord
- Defined in:
- lib/fusuma/plugin/events/records/touch_record.rb
Instance Attribute Summary collapse
-
#finger ⇒ Object
readonly
Returns the value of attribute finger.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#time_offset ⇒ Object
readonly
Returns the value of attribute time_offset.
-
#x_mm ⇒ Object
readonly
Returns the value of attribute x_mm.
-
#x_px ⇒ Object
readonly
Returns the value of attribute x_px.
-
#y_mm ⇒ Object
readonly
Returns the value of attribute y_mm.
-
#y_px ⇒ Object
readonly
Returns the value of attribute y_px.
Instance Method Summary collapse
-
#initialize(status:, finger:, time_offset:, x_px: nil, y_px: nil, x_mm: nil, y_mm: nil) ⇒ TouchRecord
constructor
A new instance of TouchRecord.
- #inspect ⇒ Object
- #position? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(status:, finger:, time_offset:, x_px: nil, y_px: nil, x_mm: nil, y_mm: nil) ⇒ TouchRecord
Returns a new instance of TouchRecord.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 20 def initialize(status:, finger:, time_offset:, x_px: nil, y_px: nil, x_mm: nil, y_mm: nil) super() @status = status.to_s @finger = finger.to_i @time_offset = time_offset.to_f @x_px = x_px.to_f if x_px @y_px = y_px.to_f if y_px @x_mm = x_mm.to_f if x_mm @y_mm = y_mm.to_f if y_mm end |
Instance Attribute Details
#finger ⇒ Object (readonly)
Returns the value of attribute finger.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def finger @finger end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def status @status end |
#time_offset ⇒ Object (readonly)
Returns the value of attribute time_offset.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def time_offset @time_offset end |
#x_mm ⇒ Object (readonly)
Returns the value of attribute x_mm.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def x_mm @x_mm end |
#x_px ⇒ Object (readonly)
Returns the value of attribute x_px.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def x_px @x_px end |
#y_mm ⇒ Object (readonly)
Returns the value of attribute y_mm.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def y_mm @y_mm end |
#y_px ⇒ Object (readonly)
Returns the value of attribute y_px.
12 13 14 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 12 def y_px @y_px end |
Instance Method Details
#inspect ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 35 def inspect s = "#{self.class} status: #{status} finger: #{finger} time offset: #{time_offset}" s << " x_px: #{x_px}" if x_px s << " y_px: #{y_px}" if y_px s << " x_mm: #{x_mm}" if x_mm s << " y_mm: #{y_mm}" if y_mm s end |
#position? ⇒ Boolean
31 32 33 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 31 def position? @x_px || @y_px end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/fusuma/plugin/events/records/touch_record.rb', line 44 def to_s inspect end |