Class: Stumb::StampSheet

Inherits:
Object
  • Object
show all
Defined in:
lib/stumb/stamp_sheet.rb

Instance Method Summary collapse

Constructor Details

#initialize(stub) ⇒ StampSheet

Returns a new instance of StampSheet.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/stumb/stamp_sheet.rb', line 6

def initialize(stub)
  @stub = stub
  @haml = Haml::Engine.new(<<HAML)
!!!
%html
  %head
  %body
%h1 Requests
%table
  - stamps.each do |stamp|
    %tr
      %td&= stamp.time.iso8601
      %td&= stamp.request.ip
      %td&= stamp.request.request_method
      %td&= stamp.request.fullpath
      %td&= stamp.body
HAML
end

Instance Method Details

#call(env) ⇒ Object



25
26
27
# File 'lib/stumb/stamp_sheet.rb', line 25

def call(env)
  [200, {"Content-Type" => "text/html"}, @haml.render(@stub)]
end