Class: Ww::SpyEye

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ww/spy_eye.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(servlet) ⇒ SpyEye

Returns a new instance of SpyEye.



26
27
28
# File 'lib/ww/spy_eye.rb', line 26

def initialize(servlet)
  @servlet = servlet
end

Class Method Details

.to_app(spy_eye_path = "/spy", &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ww/spy_eye.rb', line 10

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

    servlet = Servlet.base(&block)
    spy = SpyEye.new(servlet)

    map(spy_eye_path) { run spy }
    map("/") { run servlet }
  }
end

Instance Method Details

#call(env) ⇒ Object



30
31
32
# File 'lib/ww/spy_eye.rb', line 30

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