class GunTest::Shell::Task

Constants

PADDING

Public Class Methods

new(description) click to toggle source
# File lib/gun_test/shell/task.rb, line 6
def initialize(description)
  @description = description
  @status_length = 0
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/gun_test/shell/task.rb, line 16
def method_missing(method, *args, &block)
  @self_before_instance_eval.send method, *args, &block
end
perform(&block) click to toggle source
# File lib/gun_test/shell/task.rb, line 11
def perform(&block)
  @self_before_instance_eval = eval "self", block.binding
  instance_eval &block
end
say_status(status) click to toggle source
# File lib/gun_test/shell/task.rb, line 20
def say_status(status)
  print "\r" unless @status_length == 0

  status = " " * PADDING + @description.ljust(PADDING * 5) + status
  print status.ljust(@status_length)

  @status_length = status.length
end