Class: A11y::Lint::ErbOutputNode
- Inherits:
-
Object
- Object
- A11y::Lint::ErbOutputNode
show all
- Includes:
- BlockInspection
- Defined in:
- lib/a11y/lint/erb_output_node.rb
Overview
Wraps an extracted ERB output tag (<%= … %>) as a queryable node for lint rules.
Constant Summary
BlockInspection::ICON_HELPERS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#block_has_only_icon_helpers?
Constructor Details
#initialize(ruby_code:, line:, block_body_codes: nil, block_has_text_children: false) ⇒ ErbOutputNode
Returns a new instance of ErbOutputNode.
12
13
14
15
16
17
18
19
20
|
# File 'lib/a11y/lint/erb_output_node.rb', line 12
def initialize(
ruby_code:, line:,
block_body_codes: nil, block_has_text_children: false
)
@ruby_code = ruby_code
@line = line
@block_body_codes = block_body_codes
@block_has_text_children = block_has_text_children
end
|
Instance Attribute Details
#block_body_codes ⇒ Object
Returns the value of attribute block_body_codes.
10
11
12
|
# File 'lib/a11y/lint/erb_output_node.rb', line 10
def block_body_codes
@block_body_codes
end
|
#line ⇒ Object
Returns the value of attribute line.
10
11
12
|
# File 'lib/a11y/lint/erb_output_node.rb', line 10
def line
@line
end
|
#ruby_code ⇒ Object
Returns the value of attribute ruby_code.
10
11
12
|
# File 'lib/a11y/lint/erb_output_node.rb', line 10
def ruby_code
@ruby_code
end
|
Instance Method Details
#attribute?(name) ⇒ Boolean
26
27
28
|
# File 'lib/a11y/lint/erb_output_node.rb', line 26
def attribute?(name)
attributes.key?(name)
end
|
#attributes ⇒ Object
30
31
32
|
# File 'lib/a11y/lint/erb_output_node.rb', line 30
def attributes
{}
end
|
#block_has_text_children? ⇒ Boolean
38
39
40
|
# File 'lib/a11y/lint/erb_output_node.rb', line 38
def block_has_text_children?
@block_has_text_children
end
|
#call_node ⇒ Object
34
35
36
|
# File 'lib/a11y/lint/erb_output_node.rb', line 34
def call_node
@call_node ||= RubyCode.new(ruby_code).call_node
end
|
#children ⇒ Object
42
43
44
|
# File 'lib/a11y/lint/erb_output_node.rb', line 42
def children
[]
end
|
#tag_name ⇒ Object
22
23
24
|
# File 'lib/a11y/lint/erb_output_node.rb', line 22
def tag_name
nil
end
|