Class: BatteryGrowl

Inherits:
Object
  • Object
show all
Defined in:
lib/battery_growl/version.rb,
lib/battery_growl/battery_growl.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Constructor Details

#initializeBatteryGrowl

Returns a new instance of BatteryGrowl.



5
6
# File 'lib/battery_growl/battery_growl.rb', line 5

def initialize
end

Instance Method Details

#run(percent = 10, host = 'localhost') ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/battery_growl/battery_growl.rb', line 8

def run(percent=10,host='localhost')
  num_check(percent)
  battery_usage = check_battery
  subject = 'バッテリー容量低下'
  message = "残り#{battery_usage}%です。充電してください。"
  post_growl(subject,message,host) if battery_usage <= percent
  return true
rescue => e
  raise "#{e}"
end