Class: CfnNagRuleDumper

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn-nag/rule_dumper.rb

Instance Method Summary collapse

Constructor Details

#initialize(profile_definition: nil, rule_directory: nil) ⇒ CfnNagRuleDumper

Returns a new instance of CfnNagRuleDumper.



6
7
8
9
10
# File 'lib/cfn-nag/rule_dumper.rb', line 6

def initialize(profile_definition: nil,
               rule_directory: nil)
  @rule_directory = rule_directory
  @profile_definition = profile_definition
end

Instance Method Details

#dump_rulesObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cfn-nag/rule_dumper.rb', line 12

def dump_rules
  custom_rule_loader = CustomRuleLoader.new(rule_directory: @rule_directory)
  rule_registry = custom_rule_loader.rule_definitions

  profile = nil
  unless @profile_definition.nil?
    profile = ProfileLoader.new(rule_registry).load(profile_definition: @profile_definition)
  end

  RulesView.new.emit(rule_registry, profile)
end