Class: Guideline::CheckerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/guideline/checker_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, *checker_classes) ⇒ CheckerFactory

Returns a new instance of CheckerFactory.



3
4
5
6
# File 'lib/guideline/checker_factory.rb', line 3

def initialize(options, *checker_classes)
  @options = options
  @checker_classes = checker_classes
end

Instance Method Details

#createObject



8
9
10
11
12
# File 'lib/guideline/checker_factory.rb', line 8

def create
  @checker_classes.map do |klass|
    klass.new(options_for(klass))
  end
end

#options_for(klass) ⇒ Object



14
15
16
# File 'lib/guideline/checker_factory.rb', line 14

def options_for(klass)
  @options[klass.to_s] || {}
end