Class: UITouch

Inherits:
Object show all
Defined in:
lib/sugarcube/to_s/uitouch.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sugarcube/to_s/uitouch.rb', line 3

def to_s
  phase = case self.phase
          when UITouchPhaseBegan
            "began"
          when UITouchPhaseMoved
            "moved"
          when UITouchPhaseStationary
            "stationary"
          when UITouchPhaseEnded
            "ended"
          when UITouchPhaseCancelled
            "cancelled"
          end
  "#{self.class.name}(#{self.tapCount} #{self.tapCount == 1 ? 'tap' : 'taps'} #{phase},"\
                    " at #{self.locationInView(self.view).inspect}, @ #{self.timestamp})"
end