Class: Kettle::Dev::CacheProgress

Inherits:
Object
  • Object
show all
Defined in:
lib/kettle/dev/cache_progress.rb

Constant Summary collapse

FORMAT =
"%t %b %c/%C"
LENGTH =
30

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total:, cached_title:, live_title:, output:, enabled: true) ⇒ CacheProgress

Returns a new instance of CacheProgress.



11
12
13
14
15
16
17
# File 'lib/kettle/dev/cache_progress.rb', line 11

def initialize(total:, cached_title:, live_title:, output:, enabled: true)
  @total = total.to_i
  @cached_count = 0
  @live_count = 0
  @cached_bar = progress_bar(cached_title, output, enabled)
  @live_bar = progress_bar(live_title, output, enabled)
end

Instance Attribute Details

#cached_countObject (readonly)

Returns the value of attribute cached_count.



19
20
21
# File 'lib/kettle/dev/cache_progress.rb', line 19

def cached_count
  @cached_count
end

#live_countObject (readonly)

Returns the value of attribute live_count.



19
20
21
# File 'lib/kettle/dev/cache_progress.rb', line 19

def live_count
  @live_count
end

Instance Method Details

#cachedObject



21
22
23
24
# File 'lib/kettle/dev/cache_progress.rb', line 21

def cached
  @cached_count += 1
  @cached_bar&.increment
end

#liveObject



26
27
28
29
# File 'lib/kettle/dev/cache_progress.rb', line 26

def live
  @live_count += 1
  @live_bar&.increment
end