Class: CcProgress
Instance Attribute Summary collapse
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from FlexCocoa
Instance Method Summary collapse
- #advance(message = nil, counter = true) ⇒ Object
-
#initialize(title, message, total) ⇒ CcProgress
constructor
A new instance of CcProgress.
Methods inherited from FlexCocoa
#button_response, #buttons_template, #parts_init, #post_initialize, set_path
Constructor Details
#initialize(title, message, total) ⇒ CcProgress
Returns a new instance of CcProgress.
9 10 11 12 13 14 15 16 |
# File 'lib/flex_cocoa/cc_progress.rb', line 9 def initialize (title, , total) super() @base_message = @progress = 0 @total = total @exec << " progressbar --tile \"#{title}\" --text \"#{}\"" post_initialize end |
Instance Attribute Details
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
8 9 10 |
# File 'lib/flex_cocoa/cc_progress.rb', line 8 def progress @progress end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
8 9 10 |
# File 'lib/flex_cocoa/cc_progress.rb', line 8 def total @total end |
Instance Method Details
#advance(message = nil, counter = true) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flex_cocoa/cc_progress.rb', line 18 def advance ( = nil, counter = true) @progress += 1 output = "#{@progress / @total.to_f * 100}" if .nil? output << " #{@base_message}" else output << " #{}" end output << " (#{@progress}/#{@total})" if counter @stdin.puts output end |