lib/renderers/text.rb in garterbelt-0.0.6 vs lib/renderers/text.rb in garterbelt-0.0.7
- old
+ new
@@ -1,13 +1,14 @@
module Garterbelt
class Text < Renderer
- attr_accessor :content
+ attr_accessor :content, :escape
def initialize(opts)
super
raise ArgumentError, ":content option required for #{self.class} initialization" unless opts[:content]
self.content = opts[:content]
+ self.escape = view.escape
end
def raise_with_block_content
raise ArgumentError, "#{self.class} does not take block content" if self.content.is_a?(Proc)
end
@@ -16,13 +17,9 @@
raise_with_block_content
output << "#{indent}#{escaped_content}\n"
end
def escaped_content
- escape? ? ERB::Util.h(content) : content
- end
-
- def escape?
- !!view.escape
+ escape ? ERB::Util.h(content) : content
end
end
end