Class: Escort::OptionDependencyValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/escort/option_dependency_validator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ OptionDependencyValidator

Returns a new instance of OptionDependencyValidator.



11
12
13
# File 'lib/escort/option_dependency_validator.rb', line 11

def initialize(parser)
  @parser = parser
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



9
10
11
# File 'lib/escort/option_dependency_validator.rb', line 9

def parser
  @parser
end

Class Method Details

.for(parser) ⇒ Object



4
5
6
# File 'lib/escort/option_dependency_validator.rb', line 4

def for(parser)
  self.new(parser)
end

Instance Method Details

#validate(options, dependencies) ⇒ Object



15
16
17
18
19
20
# File 'lib/escort/option_dependency_validator.rb', line 15

def validate(options, dependencies)
  dependencies.each_pair do |option_name, dependency_rules|
    ensure_dependencies_satisfied_for(option_name, dependency_rules, options)
  end
  options
end