Class: Zerbo::SleepStage

Inherits:
Packet
  • Object
show all
Defined in:
lib/zerbo.rb

Constant Summary collapse

LOOKUP =
[
  'Undefined',
  'Awake',
  'REM',
  'Light',
  'Deep'
]

Instance Attribute Summary

Attributes inherited from Packet

#data, #owner, #sequence, #type

Instance Method Summary collapse

Methods inherited from Packet

#guess_length, inherited, #initialize, #to_i

Constructor Details

This class inherits a constructor from Zerbo::Packet

Instance Method Details

#asleep?Boolean

Returns:

  • (Boolean)


274
275
276
# File 'lib/zerbo.rb', line 274

def asleep?
  rem? || light? || deep?
end

#awake?Boolean

Returns:

  • (Boolean)


270
271
272
# File 'lib/zerbo.rb', line 270

def awake?
  to_s == 'Awake'
end

#deep?Boolean

Returns:

  • (Boolean)


286
287
288
# File 'lib/zerbo.rb', line 286

def deep?
  to_s == 'Deep'
end

#inspectObject



266
267
268
# File 'lib/zerbo.rb', line 266

def inspect
  format_inspect(to_s)
end

#light?Boolean

Returns:

  • (Boolean)


282
283
284
# File 'lib/zerbo.rb', line 282

def light?
  to_s == 'Light'
end

#rem?Boolean

Returns:

  • (Boolean)


278
279
280
# File 'lib/zerbo.rb', line 278

def rem?
  to_s == 'REM'
end

#to_sObject



262
263
264
# File 'lib/zerbo.rb', line 262

def to_s
  LOOKUP[to_i]
end