lib/ruhl.rb in ruhl-0.6.0 vs lib/ruhl.rb in ruhl-0.7.0
- old
+ new
@@ -3,14 +3,15 @@
require 'nokogiri'
require 'ruhl/errors'
module Ruhl
class Engine
- attr_reader :document, :scope, :layout, :local_object
+ attr_reader :document, :scope, :layout, :layout_source, :local_object
def initialize(html, options = {})
- @local_object = options[:local_object]
+ @local_object = options[:local_object]
+ @layout_source = options[:layout_source]
if @layout = options[:layout]
raise LayoutNotFoundError.new(@layout) unless File.exists?(@layout)
end
@@ -42,10 +43,10 @@
end
private
def render_with_layout
- render_file( File.read(@layout) )
+ render_file( @layout_source || File.read(@layout) )
end
def render_partial(tag, code)
file = execute_ruby(tag, code)
raise PartialNotFoundError.new(file) unless File.exists?(file)