Sha256: b3acf29e16df80fcfe69c6544b4a2a979926a9d845d9039976af09ce03bc0766
Contents?: true
Size: 908 Bytes
Versions: 1
Compression:
Stored size: 908 Bytes
Contents
module Slim # Base class for Temple filters used in Slim # @api private class Filter include Temple::Utils DEFAULT_OPTIONS = {} def initialize(options = {}) @options = DEFAULT_OPTIONS.merge(options) end def compile(exp) if exp[0] == :slim _, type, *args = exp else type, *args = exp end if respond_to?("on_#{type}") send("on_#{type}", *args) else exp end end def on_control(code, content) [:slim, :control, code, compile(content)] end def on_tag(name, attrs, content) [:slim, :tag, name, attrs, compile(content)] end def on_multi(*exps) [:multi, *exps.map { |exp| compile(exp) }] end end # Simple filter which prints Temple expression # @api private class Debugger < Filter def compile(exp) puts exp.inspect exp end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slim-0.7.0 | lib/slim/filter.rb |