Sha256: 4c7ad1c4bca63fb7343cb0ad972bfb0f00e75c04edef3a1c503175c4fa7dc090
Contents?: true
Size: 976 Bytes
Versions: 3
Compression:
Stored size: 976 Bytes
Contents
module Merb::InlinePartialMixin def partial(template, opts={}) unless @_template_format @web_controller.choose_template_format(Merb.available_mime_types, {}) end found_template = @web_controller._cached_partials["#{template}.#{@_template_format}"] ||= @web_controller.send(:find_partial, template, opts) template_method = found_template && found_template.gsub(/[^\.a-zA-Z0-9]/, "__").gsub(/\./, "_") unless template_method && self.respond_to?(template_method) return super end if with = opts.delete(:with) as = opts.delete(:as) || found_template.match(/(.*\/_)([^\.]*)/)[2] @_merb_partial_locals = opts sent_template = [with].flatten.map do |temp| @_merb_partial_locals[as.to_sym] = temp send(template_method) end.join else @_merb_partial_locals = opts sent_template = send(template_method) end return sent_template if sent_template end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
merb-0.5.1 | lib/merb/mixins/inline_partial.rb |
merb-0.5.3 | lib/merb/mixins/inline_partial.rb |
merb-0.5.2 | lib/merb/mixins/inline_partial.rb |