Class: Vixen::CommandLine::Base
- Inherits:
-
Object
- Object
- Vixen::CommandLine::Base
show all
- Defined in:
- lib/vixen/command_line/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
4
5
6
|
# File 'lib/vixen/command_line/base.rb', line 4
def initialize
@start = Time.now
end
|
Instance Attribute Details
#start ⇒ Object
Returns the value of attribute start.
2
3
4
|
# File 'lib/vixen/command_line/base.rb', line 2
def start
@start
end
|
Instance Method Details
#elapsed_time ⇒ Object
8
9
10
|
# File 'lib/vixen/command_line/base.rb', line 8
def elapsed_time
"[%s]" % (Time.at(Time.now - start).utc.strftime '%T')
end
|
#new_line_after ⇒ Object
12
13
14
15
16
|
# File 'lib/vixen/command_line/base.rb', line 12
def new_line_after
val = yield if block_given?
puts
val
end
|
#print(message, *args) ⇒ Object
18
19
20
21
22
|
# File 'lib/vixen/command_line/base.rb', line 18
def print(message, *args)
timed_message = "\r \r#{elapsed_time} " + message
$stdout.print timed_message, args
$stdout.flush
end
|