Module: Sinatra::Partials
- Defined in:
- lib/ext/partials.rb
Instance Method Summary collapse
Instance Method Details
#partial(template, *args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ext/partials.rb', line 13 def partial(template, *args) = args. .merge!(:layout => false) if collection = .delete(:collection) then collection.inject([]) do |buffer, member| buffer << erb(template, .merge(:layout => false, :locals => {template.to_s.gsub!("/", "_").to_sym => member})) # check with template.to_s.split("/").last.to_sym => member end.join("\n") else erb(template, ) end end |