Class: Pebble::Watch::SystemMessageEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/pebble/watch/system_message_event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/pebble/watch/system_message_event.rb', line 4

def code
  @code
end

Class Method Details

.parse(message) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/pebble/watch/system_message_event.rb', line 6

def self.parse(message)
  event = new

  event.code = message.length == 2 ? message.unpack("S>").first : -1

  event
end

Instance Method Details

#inspectObject



18
19
20
# File 'lib/pebble/watch/system_message_event.rb', line 18

def inspect
  "#{self.message} (#{self.code})"
end

#messageObject



14
15
16
# File 'lib/pebble/watch/system_message_event.rb', line 14

def message
  SystemMessages.for_code(self.code) || "Unknown"
end