Class: Madride::Environment
- Inherits:
-
Sprockets::Environment
- Object
- Sprockets::Environment
- Madride::Environment
- Defined in:
- lib/madride/environment.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(*args) ⇒ Environment
constructor
A new instance of Environment.
- #locals ⇒ Object
Constructor Details
#initialize(*args) ⇒ Environment
Returns a new instance of Environment.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/madride/environment.rb', line 12 def initialize *args super @context_class = Class.new(Context) # unregister .htm and register .html instead register_mime_type nil, '.htm' register_mime_type 'text/html', '.html' register_engine '.slim', SlimTemplate register_engine '.haml', Tilt::HamlTemplate register_preprocessor 'text/html', DirectiveProcessor Madride.paths.each do |path| append_path path end end |
Instance Method Details
#call(env) ⇒ Object
37 38 39 40 |
# File 'lib/madride/environment.rb', line 37 def call env env['PATH_INFO'] += '.html' if File.extname(unescape(env['PATH_INFO'].to_s)).empty? super end |
#locals ⇒ Object
32 33 34 |
# File 'lib/madride/environment.rb', line 32 def locals @context_class.locals end |