Class: ThemeCheck::NestedSnippet::TemplateInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/theme_check/checks/nested_snippet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#includesObject

Returns the value of attribute includes

Returns:

  • (Object)

    the current value of includes



9
10
11
# File 'lib/theme_check/checks/nested_snippet.rb', line 9

def includes
  @includes
end

Instance Method Details

#with_deep_nested(templates, max, current_level = 0) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/theme_check/checks/nested_snippet.rb', line 10

def with_deep_nested(templates, max, current_level = 0)
  includes.each do |node|
    if current_level >= max
      yield node
    else
      template_name = "snippets/#{node.value.template_name_expr}"
      templates[template_name]
        &.with_deep_nested(templates, max, current_level + 1) { yield node }
    end
  end
end