Class: ConfigurationVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/visitors/configuration_visitor.rb

Class Method Summary collapse

Class Method Details

.GenerateIDsObject



18
19
20
21
22
23
24
25
26
# File 'lib/visitors/configuration_visitor.rb', line 18

def self.GenerateIDs
  configurationsHash = self.Visit

  configurationsHash.each do |rule,configurations|
    configurations.each do |configuration|
      configuration.id = "#{rule}-#{configuration.name.downcase.gsub! ' ', '_'}"
    end
  end
end

.VisitObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/visitors/configuration_visitor.rb', line 4

def self.Visit
  configurationsHash = {}

  rules = RuleEngine.rules
  rules.each do |rule|
    configurationsHash[rule] = []
    rule.configurations.each do |configuration|
      configurationsHash[rule].append(configuration)
    end
  end

  return configurationsHash
end