Module: Stumb

Defined in:
lib/stumb.rb,
lib/stumb/stamp.rb,
lib/stumb/store.rb,
lib/stumb/servlet.rb,
lib/stumb/stamp_sheet.rb

Defined Under Namespace

Classes: Servlet, Stamp, StampSheet, Store

Constant Summary collapse

Version =
'0.1.1'

Class Method Summary collapse

Class Method Details

.to_app(sheet_path = "/sheet", &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/stumb.rb', line 12

def to_app(sheet_path = "/sheet", &block)
  Rack::Builder.new {
    use Rack::ShowExceptions

    store = Store.new
    sheet = StampSheet.new(store)

    map(sheet_path) { run sheet }

    sinatra = Class.new(Servlet)
    sinatra.storage = store
    sinatra.class_eval(&block)

    map("/") { run sinatra }
  }
end