Class: SlimLint::Filters::AttributeProcessor

Inherits:
Slim::Filter
  • Object
show all
Defined in:
lib/slim_lint/filters/attribute_processor.rb

Overview

A dumbed-down version of Slim::CodeAttributes which doesn’t introduce any temporary variables or other cruft.

Instance Method Summary collapse

Instance Method Details

#on_html_attr(name, value) ⇒ Object

Handle attribute expression ‘[:html, :attr, name, value]`

Parameters:

  • name (String)

    name of the attribute

  • value (Array)

    Sexp representing the value



21
22
23
24
25
26
27
28
29
# File 'lib/slim_lint/filters/attribute_processor.rb', line 21

def on_html_attr(name, value)
  if value[0] == :slim && value[1] == :attrvalue
    code = value[3]
    [:code, code]
  else
    @attr = name
    super
  end
end

#on_html_attrs(*attrs) ⇒ Array

Handle attributes expression ‘[:html, :attrs, *attrs]`

Parameters:

  • attrs (Array)

Returns:

  • (Array)


13
14
15
# File 'lib/slim_lint/filters/attribute_processor.rb', line 13

def on_html_attrs(*attrs)
  [:multi, *attrs.map { |a| compile(a) }]
end