Sha256: 218e89ea1ed8c25535e0cf3e444a028682ffffd121f5a627fe92f5254756bb56
Contents?: true
Size: 868 Bytes
Versions: 3
Compression:
Stored size: 868 Bytes
Contents
require 'reel' require 'octarine' module Reel # Define Reel endpoints using a sinatra-like dsl (provided by octarine) module App def self.included(base) base.class_eval do include Octarine::App attr_accessor :server end end def initialize(host, port) super() @server = Reel::Server.supervise(host, port) do |connection| while request = connection.request status, headers, body = call Rack::MockRequest.env_for(request.url, :method => request.method, :input => request.body) connection.respond status_symbol(status), headers, body.to_s end end end def status_symbol(status) status.is_a?(Fixnum) ? Http::Response::STATUS_CODES[status].downcase.gsub(/\s|-/, '_').to_sym : status.to_sym end def terminate @server.terminate end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reel-0.3.0 | lib/reel/app.rb |
reel-0.3.0.pre | lib/reel/app.rb |
reel-0.2.0 | lib/reel/app.rb |