Class: Batt::App
- Inherits:
-
Thor
- Object
- Thor
- Batt::App
- Defined in:
- lib/batt/app.rb
Instance Method Summary collapse
-
#all ⇒ Object
option :tmux, :type => :boolean option :ansi, :type => :boolean.
- #capacity ⇒ Object
- #remaining ⇒ Object
- #source ⇒ Object
- #status ⇒ Object
Instance Method Details
#all ⇒ Object
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 |
#capacity ⇒ Object
26 27 28 29 30 |
# File 'lib/batt/app.rb', line 26 def capacity b = Batt::Reader.new puts b.status[:capacity] end |
#remaining ⇒ Object
41 42 43 44 45 |
# File 'lib/batt/app.rb', line 41 def remaining b = Batt::Reader.new puts b.status[:remaining] end |
#source ⇒ Object
19 20 21 22 23 |
# File 'lib/batt/app.rb', line 19 def source b = Batt::Reader.new puts b.status[:source] end |
#status ⇒ Object
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 |