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, #name, #to_i

Constructor Details

This class inherits a constructor from Zerbo::Packet

Instance Method Details

#asleep?Boolean

Returns:

  • (Boolean)


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

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

#awake?Boolean

Returns:

  • (Boolean)


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

def awake?
  to_s == 'Awake'
end

#deep?Boolean

Returns:

  • (Boolean)


290
291
292
# File 'lib/zerbo.rb', line 290

def deep?
  to_s == 'Deep'
end

#inspectObject



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

def inspect
  format_inspect(to_s)
end

#light?Boolean

Returns:

  • (Boolean)


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

def light?
  to_s == 'Light'
end

#rem?Boolean

Returns:

  • (Boolean)


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

def rem?
  to_s == 'REM'
end

#to_sObject



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

def to_s
  LOOKUP[to_i]
end