Class: PlatformosCheck::LiquidVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/platformos_check/liquid_visitor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(checks, disabled_checks, only_single_file: false) ⇒ LiquidVisitor

Returns a new instance of LiquidVisitor.



7
8
9
10
11
# File 'lib/platformos_check/liquid_visitor.rb', line 7

def initialize(checks, disabled_checks, only_single_file: false)
  @checks = checks
  @disabled_checks = disabled_checks
  @only_single_file = only_single_file
end

Instance Attribute Details

#checksObject (readonly)

Returns the value of attribute checks.



5
6
7
# File 'lib/platformos_check/liquid_visitor.rb', line 5

def checks
  @checks
end

Instance Method Details

#visit_liquid_file(liquid_file) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/platformos_check/liquid_visitor.rb', line 13

def visit_liquid_file(liquid_file)
  visit(LiquidNode.new(liquid_file.root, nil, liquid_file))

  if @only_single_file
    checks.single_file_end_dependencies(liquid_file).each do |file|
      visit(LiquidNode.new(file.root, nil, file))
    end
  end
rescue Liquid::Error => e
  e.template_name = liquid_file.relative_path
  call_checks(:on_error, e)
end