Class: Madride::Environment

Inherits:
Sprockets::Environment
  • Object
show all
Defined in:
lib/madride/environment.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Environment

Returns a new instance of Environment.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/madride/environment.rb', line 11

def initialize *args
  super

  register_engine '.slim', SlimTemplate
  register_engine '.haml', Tilt::HamlTemplate

  Madride.paths.each do |path|
    append_path path
  end


  @context_class.send(:include, ContextPatch)
end

Instance Method Details

#call(env) ⇒ Object



31
32
33
34
# File 'lib/madride/environment.rb', line 31

def call env
  env['PATH_INFO'] += '.html' if File.extname(unescape(env['PATH_INFO'].to_s)).empty?
  super
end

#localsObject



26
27
28
# File 'lib/madride/environment.rb', line 26

def locals
  @context_class.locals
end