Class Nukumi2::Bricklet
In: lib/nukumi2/bricklet.rb
Parent: WEBrick::HTTPServlet::AbstractServlet

Methods

do_GET   get_instance   new  

Public Class methods

[Source]

   # File lib/nukumi2/bricklet.rb, line 3
3:     def initialize(blog)
4:       @blog = blog
5:     end

Public Instance methods

[Source]

    # File lib/nukumi2/bricklet.rb, line 11
11:     def do_GET(req, res)
12:       begin
13:         time = Time.now
14:         page = @blog.fetch(req.path)
15:         res.body = page.render
16:         res['Content-Type'] = page.content_type
17: #        res.body << "Took #{Time.now-time}s"
18:       rescue Nukumi2::Blog::NotFound
19:         raise WEBrick::HTTPStatus::NotFound, $!.message || "Page not found."
20:       end
21:     end

[Source]

   # File lib/nukumi2/bricklet.rb, line 7
7:     def get_instance(config)
8:       self
9:     end

[Validate]