lib/renderers/renderer.rb in garterbelt-0.1.0 vs lib/renderers/renderer.rb in garterbelt-0.1.1
- old
+ new
@@ -1,11 +1,14 @@
module Garterbelt
class Renderer
- attr_accessor :view
+ attr_accessor :view, :escape
+ attr_writer :style
def initialize(opts)
self.view = opts[:view] || raise(ArgumentError, ":view required in initialization options")
+ self.style = opts.delete(:render_style)
+ self.escape = view._escape
end
# Rendering -----------------------------------------------
def output
view.output
@@ -18,10 +21,10 @@
def level
view._level
end
def style
- view.render_style
+ @style ||= view.render_style
end
def indent
style == :minified ? "" : ' '*level*2
end
\ No newline at end of file