Created
April 26, 2010 09:31
-
-
Save judofyr/379142 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
T = {} | |
L = :layout | |
# Finds a template, returning either: | |
# | |
# false # => Could not find template | |
# true # => Found template in Views | |
# instance of Tilt # => Found template in a file | |
def lookup(n) | |
T.fetch(n.to_sym) do |k| | |
T[k] = Views.method_defined?(k) || | |
(f = Dir[[O[:views] || "views", "#{n}.*"]*'/'][0]) && | |
Tilt.new(f, O[f[/\.(\w+)$/, 1].to_sym] || {}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment