Class: Frontman::Process::Chain

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/frontman/process/chain.rb

Instance Method Summary collapse

Constructor Details

#initialize(processors = []) ⇒ Chain

Returns a new instance of Chain.



16
17
18
19
20
# File 'lib/frontman/process/chain.rb', line 16

def initialize(processors = [])
  @processors = []

  add_processors(processors)
end

Instance Method Details

#add_processors(processors) ⇒ Object



30
31
32
33
# File 'lib/frontman/process/chain.rb', line 30

def add_processors(processors)
  @processors.push(*Array(processors))
  self
end

#process(*arguments) ⇒ Object



36
37
38
39
40
# File 'lib/frontman/process/chain.rb', line 36

def process(*arguments)
  @processors.map do |processor|
    processor.process(*arguments)
  end
end