Module: HamlI18nLint::Linter::CompilerExtension
- Included in:
- HamlI18nLint::Linter5::CompilerExtension
- Defined in:
- lib/haml_i18n_lint/linter/compiler_extension.rb
Instance Method Summary collapse
- #compile_plain ⇒ Object
- #compile_script ⇒ Object
- #compile_tag ⇒ Object
- #lint_attributes ⇒ Object
- #lint_attributes_hashes ⇒ Object
Instance Method Details
#compile_plain ⇒ Object
10 11 12 13 14 |
# File 'lib/haml_i18n_lint/linter/compiler_extension.rb', line 10 def compile_plain super text = @node.value[:text] lint_add(text) if lint_config.need_i18n?(text) end |
#compile_script ⇒ Object
5 6 7 8 |
# File 'lib/haml_i18n_lint/linter/compiler_extension.rb', line 5 def compile_script super lint_script(@node.value[:text]) end |
#compile_tag ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/haml_i18n_lint/linter/compiler_extension.rb', line 26 def compile_tag super if @node.value[:parse] lint_script(@node.value[:value]) else value = @node.value[:value] lint_add(value) if lint_config.need_i18n?(value) end placeholder = @node.value.dig(:attributes, 'placeholder') || "" lint_add(placeholder) if lint_config.need_i18n?(placeholder) value = @node.value.dig(:attributes, 'value') || "" lint_add(value) if lint_config.need_i18n?(value) lint_attributes end |
#lint_attributes ⇒ Object
20 21 22 23 24 |
# File 'lib/haml_i18n_lint/linter/compiler_extension.rb', line 20 def lint_attributes lint_attributes_hashes.any? do |attributes_hash| lint_script("{#{attributes_hash}}") end end |
#lint_attributes_hashes ⇒ Object
16 17 18 |
# File 'lib/haml_i18n_lint/linter/compiler_extension.rb', line 16 def lint_attributes_hashes @node.value[:attributes_hashes] end |