Class: Batt::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/batt/app.rb

Instance Method Summary collapse

Instance Method Details

#allObject

option :tmux, :type => :boolean option :ansi, :type => :boolean



7
8
9
10
11
12
13
14
15
16
# File 'lib/batt/app.rb', line 7

def all
  b = Batt::Reader.new
  result = b.status

  size = result.keys.map{ |k| k.length }.reduce(0) { |m, l| m = l if l > m; m }
  result.each do |k,v|
    puts "%#{ size }s: %s" % [ k, v ]
  end

end

#capacityObject



26
27
28
29
30
# File 'lib/batt/app.rb', line 26

def capacity
  b = Batt::Reader.new

  puts b.status[:capacity]
end

#remainingObject



41
42
43
44
45
# File 'lib/batt/app.rb', line 41

def remaining
  b = Batt::Reader.new

  puts b.status[:remaining]
end

#sourceObject



19
20
21
22
23
# File 'lib/batt/app.rb', line 19

def source
  b = Batt::Reader.new

  puts b.status[:source]
end

#statusObject



33
34
35
36
37
38
# File 'lib/batt/app.rb', line 33

def status
  b = Batt::Reader.new
  result = b.status

  puts b.status[:status]
end