Sha256: bf494a2aac58432f2b86a76a30f8bae410f1595e0513d11144f378d8b669ef39
Contents?: true
Size: 603 Bytes
Versions: 41
Compression:
Stored size: 603 Bytes
Contents
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
Version data entries
41 entries across 41 versions & 1 rubygems