remove some unused instance variables

This commit is contained in:
tdreyno 2009-08-11 11:21:49 -07:00
parent cc2664cf09
commit ee915b62bb
2 changed files with 8 additions and 6 deletions

View file

@ -82,16 +82,14 @@ class Middleman < Sinatra::Base
get /(.*)/ do |path| get /(.*)/ do |path|
path << "index.html" if path.match(%r{/$}) path << "index.html" if path.match(%r{/$})
path.gsub!(%r{^/}, '') path.gsub!(%r{^/}, '')
path.gsub!(File.extname(path), '')
@template = path.gsub(File.extname(path), '').to_sym
@full_request_path = path
result = nil result = nil
begin begin
%w(haml erb builder maruku mab).detect do |renderer| %w(haml erb builder maruku mab).detect do |renderer|
next false if !File.exists?(File.join(options.views, "#{@template}.#{renderer}")) next false if !File.exists?(File.join(options.views, "#{path}.#{renderer}"))
renderer = "markaby" if renderer == "mab" renderer = "markaby" if renderer == "mab"
result = send(renderer.to_sym, @template) result = send(renderer.to_sym, path.to_sym)
end end
rescue Haml::Error => e rescue Haml::Error => e
result = "Haml Error: #{e}" result = "Haml Error: #{e}"

View file

@ -5,8 +5,12 @@ def link_to(title, url="#", params={})
end end
def page_classes(*additional) def page_classes(*additional)
path = env["REQUEST_PATH"]
path << "index.html" if path.match(%r{/$})
path.gsub!(%r{^/}, '')
classes = [] classes = []
parts = @full_request_path.split('.')[0].split('/') parts = path.split('.')[0].split('/')
parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') } parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }
classes << "index" if classes.empty? classes << "index" if classes.empty?