Class: ServiceStack::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/service_stack/pipeline.rb

Constant Summary collapse

PIPES_MAP =
{
  uppercase: Pipes::UppercasePipe
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(pipes) ⇒ Pipeline

Returns a new instance of Pipeline.



7
8
9
10
11
# File 'lib/service_stack/pipeline.rb', line 7

def initialize(pipes)
  @pipes = pipes.map do |pipe|
    pipe.is_a?(Symbol) ? PIPES_MAP.fetch(pipe) : pipe
  end
end

Instance Method Details

#transform(value) ⇒ Object



13
14
15
16
17
# File 'lib/service_stack/pipeline.rb', line 13

def transform(value)
  @pipes.reduce(value) do |new_value, pipe|
    pipe.transform(new_value)
  end
end