Class: Ticker
- Inherits:
-
Object
- Object
- Ticker
- Defined in:
- lib/sqs_cli/ticker.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize(count = 0, opts = {}) ⇒ Ticker
constructor
A new instance of Ticker.
- #uptime ⇒ Object
Constructor Details
#initialize(count = 0, opts = {}) ⇒ Ticker
Returns a new instance of Ticker.
4 5 6 7 8 |
# File 'lib/sqs_cli/ticker.rb', line 4 def initialize(count=0, opts={}) @count = count @silent = opts.fetch(:silent, false) @start_time = Time.now end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
2 3 4 |
# File 'lib/sqs_cli/ticker.rb', line 2 def count @count end |
Instance Method Details
#increment ⇒ Object
10 11 12 13 |
# File 'lib/sqs_cli/ticker.rb', line 10 def increment print "." unless @silent @count += 1 end |
#uptime ⇒ Object
15 16 17 18 |
# File 'lib/sqs_cli/ticker.rb', line 15 def uptime @end_time = Time.now (@end_time - @start_time).round(2) end |