Class: ProgressTasksLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total_count:) ⇒ ProgressTasksLogger

Returns a new instance of ProgressTasksLogger.



6
7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 6

def initialize(total_count:)
  @total_count = total_count
  @current_count = 0
end

Instance Attribute Details

#current_countObject

Returns the value of attribute current_count.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 4

def current_count
  @current_count
end

#total_countObject

Returns the value of attribute total_count.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 4

def total_count
  @total_count
end

Instance Method Details

#increment(value: 1) ⇒ Object



15
16
17
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 15

def increment(value: 1)
  self.current_count += value
end

#progress_stringObject



19
20
21
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 19

def progress_string
  "(#{current_count}/#{total_count})"
end

#resetObject



11
12
13
# File 'lib/admiral-tools-figma/helper/figma/figma_image_downloader/helpers/progress_tasks_logger.rb', line 11

def reset
  self.current_count = 0
end