Method: LinuxStat::Battery.charge_full_design_wh

Defined in:
lib/linux_stat/battery.rb

.charge_full_design_whObject

Returns the charge full design WH of the battery as Integer However if the info isn’t available or there’s no BAT0 in the system, this will return nil



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/linux_stat/battery.rb', line 132

def charge_full_design_wh
    # voltage min design
    @@vmd_f ||= File.join(PATH, 'voltage_min_design'.freeze)
    v_m_d = File.readable?(@@vmd_f) ? IO.read(@@vmd_f).to_i : nil

    # charge full design
    @@cfd_f ||= File.join(PATH, 'charge_full_design'.freeze)
    c_f_d = File.readable?(@@cfd_f) ? IO.read(@@cfd_f).to_i : nil

    if v_m_d && c_f_d
      v_m_d.fdiv(1_000_000).*(c_f_d.fdiv(1_000_000)).round(2)
    else
      nil
    end
end