Class: Rupower::Battery

Inherits:
PowerDevice show all
Defined in:
lib/rupower.rb

Constant Summary collapse

METHODS =
[:native_path, :vendor, :model, :serial, :power_supply, :updated,
:has_history, :has_statistics, :present, :rechargeable, :state,
:energy, :energy_empty, :energy_full, :energy_full_design,
:energy_rate, :voltage, :percentage, :capacity, :technology]

Instance Method Summary collapse

Methods inherited from PowerDevice

#get_all, #initialize

Constructor Details

This class inherits a constructor from Rupower::PowerDevice

Instance Method Details

#charging?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/rupower.rb', line 67

def charging?
  get_all[:state] == "charging"
end

#fully_charged?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/rupower.rb', line 71

def fully_charged?
  get_all[:state] == "fully-charged"
end

#refreshObject



63
64
65
# File 'lib/rupower.rb', line 63

def refresh()
  @state = @command.battery
end