Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 174097ddf3
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (17 sloc) 0.659 kB
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
if collection = options.delete(:collection) then
collection.inject([]) do |buffer, member|
buffer << haml(:"#{template}", options.merge(:layout =>
false, :locals => {template_array[-1].to_sym => member}))
end.join("\n")
else
haml(:"#{template}", options)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.