Class: Ramekin::Chain

Inherits:
Processor show all
Defined in:
lib/ramekin/processor.rb

Instance Attribute Summary

Attributes inherited from Processor

#stream

Instance Method Summary collapse

Methods inherited from Processor

#buffer, call, compose, #each, #flush!, #next!, #peek

Constructor Details

#initialize(processors) ⇒ Chain



55
56
57
# File 'lib/ramekin/processor.rb', line 55

def initialize(processors)
  @processors = processors
end

Instance Method Details

#call(stream, &b) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/ramekin/processor.rb', line 59

def call(stream, &b)
  out = stream

  @processors.each do |p|
    out = p.call(out)
  end

  out
end