File: partials.rb

package info (click to toggle)
ruby-rabl 0.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,280 kB
  • sloc: ruby: 6,732; javascript: 102; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Rabl
  module Partials
    include Helpers
    include Sources

    def partial_as_engine(file, options = {}, &block)
      raise ArgumentError, "Must provide an :object option to render a partial" unless options.has_key?(:object)

      object    = options.delete(:object)
      view_path = options[:view_path] || self.view_path

      source, location = fetch_source(file, :view_path => view_path)

      options = options.merge(:source => source, :source_location => location, :template => file)
      object_to_engine(object, options, &block)
    end
  end
end