Class: DeployPin::Collector
- Inherits:
-
Object
- Object
- DeployPin::Collector
- Defined in:
- lib/deploy_pin/collector.rb
Instance Attribute Summary collapse
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
Instance Method Summary collapse
-
#executable ⇒ Object
:reek:FeatureEnvy.
-
#initialize(identifiers:) ⇒ Collector
constructor
A new instance of Collector.
-
#list ⇒ Object
:reek:TooManyStatements.
-
#mark_done ⇒ Object
:reek:FeatureEnvy.
-
#run ⇒ Object
:reek:TooManyStatements.
- #short_list ⇒ Object
- #tasks_count ⇒ Object
Constructor Details
#initialize(identifiers:) ⇒ Collector
Returns a new instance of Collector.
8 9 10 |
# File 'lib/deploy_pin/collector.rb', line 8 def initialize(identifiers:) @identifiers = identifiers end |
Instance Attribute Details
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
6 7 8 |
# File 'lib/deploy_pin/collector.rb', line 6 def formatter @formatter end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
6 7 8 |
# File 'lib/deploy_pin/collector.rb', line 6 def identifiers @identifiers end |
Instance Method Details
#executable ⇒ Object
:reek:FeatureEnvy
46 47 48 49 50 51 |
# File 'lib/deploy_pin/collector.rb', line 46 def executable tasks = init_tasks tasks.map.with_index do |task, index| task if tasks[0..index].none? { |other_task| task.eql?(other_task) } end.compact end |
#list ⇒ Object
:reek:TooManyStatements
21 22 23 24 25 26 |
# File 'lib/deploy_pin/collector.rb', line 21 def list tasks = init_tasks tasks.each_with_index do |task, index| DeployPin.list_formatter.call(index, task) end end |
#mark_done ⇒ Object
:reek:FeatureEnvy
37 38 39 40 41 42 43 |
# File 'lib/deploy_pin/collector.rb', line 37 def mark_done tasks = init_tasks tasks.each do |task| task.prepare task.mark end end |
#run ⇒ Object
:reek:TooManyStatements
13 14 15 16 17 18 |
# File 'lib/deploy_pin/collector.rb', line 13 def run tasks = init_tasks tasks.each_with_index do |task, index| DeployPin.task_wrapper.call(task, -> { process(tasks, task, index) }) end end |
#short_list ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/deploy_pin/collector.rb', line 28 def short_list groups_tasks = init_tasks.group_by(&:group).to_a groups_tasks.inject(0) do |offset, (group, tasks)| DeployPin.short_list_formatter.call(group, tasks, offset) offset + tasks.count end end |
#tasks_count ⇒ Object
53 54 55 |
# File 'lib/deploy_pin/collector.rb', line 53 def tasks_count init_tasks.count end |