Sha256: 355f7e038339080f45fb12d4dd5cb398bd1d57c8c184a1d1221ae53ff0a5d6cf
Contents?: true
Size: 874 Bytes
Versions: 1
Compression:
Stored size: 874 Bytes
Contents
module Hotcell class Template attr_reader :source, :options def self.parse source new source, commands: Hotcell.commands, blocks: Hotcell.blocks end def initialize source, options = {} @source = Source.wrap(source, options.delete(:file)) @options = options end def syntax @syntax ||= Parser.new(source, options.slice(:commands, :blocks)).parse end def render context = {} if context.is_a?(Context) syntax.render(context) else default_context = { helpers: Hotcell.helpers } syntax.render(Context.new(default_context.merge!(context))) end end def render! context = {} if context.is_a?(Context) context.options[:reraise] = true render context else render context.merge(reraise: true) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hotcell-0.1.0 | lib/hotcell/template.rb |