Sha256: 72af16850b5e746afb79fe61e65294d9e59b2d672d2d98f4af9be2965b2c5960

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

Toycol::Protocol.define(:duck) do
  custom_status_codes(
    600 => "I'm afraid you are not a duck..."
  )
  additional_request_methods "OTHER"

  request.path do |message|
    %r{(?<path>\/\w*)}.match(message)[:path]
  end

  request.query do |message|
    %r{\<3(?<query>.+)}.match(message) { |m| m[:query] }
  end

  request.http_method do |message|
    case message.scan(/quack/).size
    when 2 then "GET"
    else "OTHER"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toycol-1.0.0 examples/duck/Protocolfile.duck
toycol-0.3.1 examples/duck/Protocolfile.duck
toycol-0.3.0 examples/duck/Protocolfile.duck