Class: Syntropy::Markdown::Controller
- Inherits:
-
Object
- Object
- Syntropy::Markdown::Controller
- Defined in:
- lib/syntropy/markdown.rb
Overview
Implements a Markdown file controller.
Instance Method Summary collapse
-
#initialize(env, atts, md) ⇒ Controller
constructor
A new instance of Controller.
-
#to_proc ⇒ Proc
Returns the controller proc.
Constructor Details
#initialize(env, atts, md) ⇒ Controller
Returns a new instance of Controller.
17 18 19 20 21 22 |
# File 'lib/syntropy/markdown.rb', line 17 def initialize(env, atts, md) @env = env @atts = atts @md = md @module_loader = env[:module_loader] end |
Instance Method Details
#to_proc ⇒ Proc
Returns the controller proc.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/syntropy/markdown.rb', line 27 def to_proc ->(req) { case req.method when 'head' req.respond_html(nil) when 'get' md = html = render(md) req.respond_html(html) else req.respond(nil, ':status' => HTTP::METHOD_NOT_ALLOWED) end } end |