Class: Caldera::Events::StatsEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/caldera/events.rb

Defined Under Namespace

Classes: Cpu, Memory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, _node) ⇒ StatsEvent

Returns a new instance of StatsEvent.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/caldera/events.rb', line 75

def initialize(data, _node)
  @playing_players = data['playingPlayers']
  @memory = Memory.new(**data['memory'])

  cpu_data = data['cpu']
  snake_case_data = {
    cores: cpu_data['cores'],
    system_load: cpu_data['systemLoad'],
    lavalink_load: cpu_data['lavalinkLoad']
  }
  @cpu = Cpu.new(**snake_case_data)
  @uptime = data['uptime']
end

Instance Attribute Details

#cpuObject (readonly)

Returns the value of attribute cpu.



73
74
75
# File 'lib/caldera/events.rb', line 73

def cpu
  @cpu
end

#memoryObject (readonly)

Returns the value of attribute memory.



73
74
75
# File 'lib/caldera/events.rb', line 73

def memory
  @memory
end

#playing_playersObject (readonly)

Returns the value of attribute playing_players.



73
74
75
# File 'lib/caldera/events.rb', line 73

def playing_players
  @playing_players
end

#uptimeObject (readonly)

Returns the value of attribute uptime.



73
74
75
# File 'lib/caldera/events.rb', line 73

def uptime
  @uptime
end