Class: Jpmobile::Sinatra::Base

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/jpmobile/sinatra.rb

Instance Method Summary collapse

Instance Method Details

#find_template(views, name, engine) ⇒ Object

Calls the given block for every possible template file in views, named name.ext, where ext is registered on engine.


6
7
8
9
10
11
12
13
# File 'lib/jpmobile/sinatra.rb', line 6

def find_template(views, name, engine)
  if env['rack.jpmobile'] and !env['rack.jpmobile'].variants.empty?
    env['rack.jpmobile'].variants.each do |variant|
      yield ::File.join(views, "#{name}_#{variant}.#{@preferred_extension}")
    end
  end
  super
end