Class: Wp2txt::CmdProgbar
- Inherits:
-
Object
- Object
- Wp2txt::CmdProgbar
- Defined in:
- lib/wp2txt/progressbar.rb
Instance Attribute Summary collapse
-
#last_value ⇒ Object
Returns the value of attribute last_value.
-
#pbar ⇒ Object
Returns the value of attribute pbar.
Instance Method Summary collapse
- #after ⇒ Object
- #before ⇒ Object
- #data_set(filename, linesize) ⇒ Object
- #data_update(nhits, nsentences) ⇒ Object
-
#initialize ⇒ CmdProgbar
constructor
A new instance of CmdProgbar.
- #msg(str, i = nil) ⇒ Object
- #prg_update(value, elt, eta) ⇒ Object
Constructor Details
#initialize ⇒ CmdProgbar
Returns a new instance of CmdProgbar.
264 265 266 267 |
# File 'lib/wp2txt/progressbar.rb', line 264 def initialize @last_value = 0 @pbar = nil end |
Instance Attribute Details
#last_value ⇒ Object
Returns the value of attribute last_value.
262 263 264 |
# File 'lib/wp2txt/progressbar.rb', line 262 def last_value @last_value end |
#pbar ⇒ Object
Returns the value of attribute pbar.
262 263 264 |
# File 'lib/wp2txt/progressbar.rb', line 262 def @pbar end |
Instance Method Details
#after ⇒ Object
299 300 301 302 |
# File 'lib/wp2txt/progressbar.rb', line 299 def after @pbar.finish return true end |
#before ⇒ Object
295 296 297 |
# File 'lib/wp2txt/progressbar.rb', line 295 def before initialize end |
#data_set(filename, linesize) ⇒ Object
286 287 288 |
# File 'lib/wp2txt/progressbar.rb', line 286 def data_set(filename, linesize) @pbar = NewProgressBar.new(filename, linesize) end |
#data_update(nhits, nsentences) ⇒ Object
290 291 292 293 |
# File 'lib/wp2txt/progressbar.rb', line 290 def data_update(nhits, nsentences) @pbar.nhits = nhits @pbar.nsentences = nsentences end |
#msg(str, i = nil) ⇒ Object
269 270 271 272 273 274 275 276 |
# File 'lib/wp2txt/progressbar.rb', line 269 def msg(str, i = nil) case i when 0 print str else puts str end end |
#prg_update(value, elt, eta) ⇒ Object
278 279 280 281 282 283 284 |
# File 'lib/wp2txt/progressbar.rb', line 278 def prg_update(value, elt, eta) @elt = elt @eta = eta offset = value - @last_value @pbar.inc(offset.to_i) @last_value = value end |