mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
layouts in dsl
This commit is contained in:
parent
ca5f8f35cb
commit
09f4eac1bf
1 changed files with 8 additions and 0 deletions
|
@ -28,4 +28,12 @@ module Kernel
|
|||
end_eval
|
||||
end
|
||||
|
||||
def layout(name = :layout, options = {})
|
||||
Layouts[name] = unless block_given?
|
||||
File.read("%s/%s" % [options[:views_directory] || 'views', name])
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue