Method: LinuxStat::Battery.stat

Defined in:
lib/linux_stat/battery.rb

.statObject

Returns the details of the battery.

If the battery is not present it will return an empty Hash.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/linux_stat/battery.rb', line 18

def stat
	st = status.downcase
	return {} unless present?

	{
		model: model,
		manufacturer: manufacturer,
		technology: technology,
		status: status,
		charge: charge,
		charging: %w(full charging unknown).each(&:freeze).include?(st),
		discharging: st == 'discharging'.freeze,
		full: st == 'full'.freeze,
	}
end