Sha256: e8213318f0d34d633600501482fb6840b9090e1bfa21535bfefddbe9fd7f8269
Contents?: true
Size: 893 Bytes
Versions: 1
Compression:
Stored size: 893 Bytes
Contents
module ShamRack module Registry def mount(rack_app, address, port = nil) port ||= Net::HTTP.default_port registry[[address, port]] = rack_app end def rackup(address, port = nil, &block) app = Rack::Builder.new(&block).to_app mount(app, address, port) end def lambda(address, port = nil, &block) mount(block, address, port) end def sinatra(address, port = nil, &block) require "sinatra/base" sinatra_app = Class.new(Sinatra::Base) sinatra_app.class_eval(&block) mount(sinatra_app.new, address, port) end def unmount_all registry.clear end def application_for(address, port = nil) port ||= Net::HTTP.default_port registry[[address, port]] end private def registry @registry ||= {} end end extend Registry end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mdub-sham_rack-1.0.0 | lib/sham_rack/registry.rb |