Class: PlatformosCheck::UnusedAssign::TemplateInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/platformos_check/checks/unused_assign.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assign_nodesObject

Returns the value of attribute assign_nodes

Returns:

  • (Object)

    the current value of assign_nodes



17
18
19
# File 'lib/platformos_check/checks/unused_assign.rb', line 17

def assign_nodes
  @assign_nodes
end

#includesObject

Returns the value of attribute includes

Returns:

  • (Object)

    the current value of includes



17
18
19
# File 'lib/platformos_check/checks/unused_assign.rb', line 17

def includes
  @includes
end

#used_assignsObject

Returns the value of attribute used_assigns

Returns:

  • (Object)

    the current value of used_assigns



17
18
19
# File 'lib/platformos_check/checks/unused_assign.rb', line 17

def used_assigns
  @used_assigns
end

Instance Method Details

#collect_used_assigns(templates, visited = Set.new) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/platformos_check/checks/unused_assign.rb', line 18

def collect_used_assigns(templates, visited = Set.new)
  collected = used_assigns
  # Check recursively inside included snippets for use
  includes.each do |name|
    if templates[name] && !visited.include?(name)
      visited << name
      collected += templates[name].collect_used_assigns(templates, visited)
    end
  end
  collected
end