Class: Rack::Hypertemplate
- Inherits:
-
Object
- Object
- Rack::Hypertemplate
- Defined in:
- lib/hypertemplate/hook/sinatra.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Hypertemplate
constructor
A new instance of Hypertemplate.
Constructor Details
#initialize(app) ⇒ Hypertemplate
Returns a new instance of Hypertemplate.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hypertemplate/hook/sinatra.rb', line 7 def initialize(app) @app = app @registry = ::Hypertemplate::Registry.new if block_given? yield @registry else @registry << ::Hypertemplate::Builder::Json @registry << ::Hypertemplate::Builder::Xml end end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 |
# File 'lib/hypertemplate/hook/sinatra.rb', line 18 def call(env) env["hypertemplate"] = @registry @app.call(env) end |