Class: DeployPin::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/deploy_pin/collector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#formatterObject (readonly)

Returns the value of attribute formatter.



6
7
8
# File 'lib/deploy_pin/collector.rb', line 6

def formatter
  @formatter
end

#identifiersObject (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

#executableObject



29
30
31
32
33
34
35
# File 'lib/deploy_pin/collector.rb', line 29

def executable
  # cache tasks
  _tasks = tasks
  _tasks.map.with_index do |task, index|
    task if _tasks[0..index].none? { |_task| task.eql?(_task) }
  end.compact
end

#listObject

:reek:TooManyStatements



22
23
24
25
26
27
# File 'lib/deploy_pin/collector.rb', line 22

def list
  _tasks = tasks
  _tasks.each_with_index do |task, index|
    DeployPin.list_formatter.call(index, task)
  end
end

#runObject

:reek:TooManyStatements



13
14
15
16
17
18
19
# File 'lib/deploy_pin/collector.rb', line 13

def run
  # cache tasks
  _tasks = tasks
  _tasks.each_with_index do |task, index|
    DeployPin.task_wrapper.call(task, -> { process(_tasks, task, index) })
  end
end

#tasks_countObject



37
38
39
# File 'lib/deploy_pin/collector.rb', line 37

def tasks_count
  tasks.count
end