Class: Slim::Splat::Filter Private
- Defined in:
- lib/slim/splat/filter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:merge_attrs, :attr_quote, :sort_attrs, :default_tag, :hyphen_attrs]
Instance Method Summary collapse
- #call(exp) ⇒ Object private
-
#on_html_attrs(*attrs) ⇒ Array
private
Handle attributes expression
[:html, :attrs, *attrs]
. -
#on_html_tag(name, attrs, content = nil) ⇒ Array
private
Handle tag expression
[:html, :tag, name, attrs, content]
.
Methods inherited from Filter
#on_slim_control, #on_slim_embedded, #on_slim_output, #on_slim_text
Instance Method Details
#call(exp) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/slim/splat/filter.rb', line 9 def call(exp) @splat_options = nil exp = compile(exp) if @splat_options opts = .to_hash.reject {|k,v| !OPTIONS.include?(k) }.inspect [:multi, [:code, "#{@splat_options} = #{opts}"], exp] else exp end end |
#on_html_attrs(*attrs) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Handle attributes expression [:html, :attrs, *attrs]
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/slim/splat/filter.rb', line 46 def on_html_attrs(*attrs) if attrs.any? {|attr| splat?(attr) } builder, block = make_builder(attrs) [:multi, block, [:dynamic, "#{builder}.build_attrs"]] else super end end |
#on_html_tag(name, attrs, content = nil) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Handle tag expression [:html, :tag, name, attrs, content]
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/slim/splat/filter.rb', line 26 def on_html_tag(name, attrs, content = nil) return super if name != '*' builder, block = make_builder(attrs[2..-1]) if content [:multi, block, [:slim, :output, false, "#{builder}.build_tag #{empty_exp?(content) ? '{}' : 'do'}", compile(content)]] else [:multi, block, [:dynamic, "#{builder}.build_tag"]] end end |