Sha256: af931a0eab8872cced8e873b0cf1e5103bcbc2f4de046f63eb70f1f616321725
Contents?: true
Size: 493 Bytes
Versions: 1
Compression:
Stored size: 493 Bytes
Contents
require "rack" require "rackrack/stub" require "delegate" module Rackrack class Builder < SimpleDelegator def initialize(name, stub: false, app: ->(env) { [ 404, {}, [] ] }, &block) Rackrack.stubs[name] = @stub = (stub &&= Stub.build) @app = Rack::Builder.app do use stub if stub run app end super(@app) end def stub(&block) @stub.stub(&block) end def reset_stub @stub.reset! end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rackrack-0.1.1 | lib/rackrack/builder.rb |