Sha256: 480035de8b0c32cf50b709e03c7ea3203289b02ef4f601832861f71adaad792b

Contents?: true

Size: 590 Bytes

Versions: 3

Compression:

Stored size: 590 Bytes

Contents

module Crystal
  module Processors
    class EvaluateFormat < Processor
      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 "Two :format parameters!" if params.include?(:format) 
          workspace.params = params.clone
          workspace.params.format = format
        else
          params.format ||= config.default_format!
        end
        
        next_processor.call
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
crystal-0.0.13 lib/crystal/http/processors/evaluate_format.rb
crystal-0.0.12 lib/crystal/http/processors/evaluate_format.rb
crystal_ext-0.0.11 lib/crystal/http/processors/evaluate_format.rb