Class: EvaluateFormat

Inherits:
Rad::Conveyors::Processor show all
Defined in:
lib/rad/http/processors/evaluate_format.rb

Instance Attribute Summary

Attributes inherited from Rad::Conveyors::Processor

#next_processor

Instance Method Summary collapse

Methods inherited from Rad::Conveyors::Processor

#initialize, inspect

Constructor Details

This class inherits a constructor from Rad::Conveyors::Processor

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rad/http/processors/evaluate_format.rb', line 4

def call
  path = workspace.path.must_be.defined
  params = workspace.params.must_be.defined
  parts = path.split('.')
  if parts.size > 1
    format = parts.last
    logger.warn "RAD two :format parameters!" if params.include?(:format)
    workspace.params = params.clone
    workspace.params.format = format
  else
    params.format ||= rad.http.default_format
  end

  next_processor.call
end