Class: Reviewer::Configuration::Loader
- Inherits:
-
Object
- Object
- Reviewer::Configuration::Loader
- Defined in:
- lib/reviewer/configuration/loader.rb
Overview
Provides a collection of the configured tools
Defined Under Namespace
Classes: InvalidConfigurationError, MissingConfigurationError, MissingReviewCommandError
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Class Method Summary collapse
-
.configuration(file:) ⇒ Hash
Loads and returns the tools configuration hash.
Instance Method Summary collapse
-
#initialize(file:) ⇒ Loader
constructor
Creates a loader instance for the configuration file.
-
#review_commands_present? ⇒ Boolean
Whether all configured tools have a review command.
-
#to_h ⇒ Hash
Converts the loader to its configuration hash.
Constructor Details
#initialize(file:) ⇒ Loader
Creates a loader instance for the configuration file
27 28 29 30 31 32 |
# File 'lib/reviewer/configuration/loader.rb', line 27 def initialize(file:) @file = file @configuration = configuration_hash validate_configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
18 19 20 |
# File 'lib/reviewer/configuration/loader.rb', line 18 def configuration @configuration end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
18 19 20 |
# File 'lib/reviewer/configuration/loader.rb', line 18 def file @file end |
Class Method Details
.configuration(file:) ⇒ Hash
Loads and returns the tools configuration hash
49 |
# File 'lib/reviewer/configuration/loader.rb', line 49 def self.configuration(file:) = new(file: file).configuration |
Instance Method Details
#review_commands_present? ⇒ Boolean
Whether all configured tools have a review command
37 38 39 |
# File 'lib/reviewer/configuration/loader.rb', line 37 def review_commands_present? configuration.all? { |_key, value| value[:commands]&.key?(:review) } end |
#to_h ⇒ Hash
Converts the loader to its configuration hash
44 |
# File 'lib/reviewer/configuration/loader.rb', line 44 def to_h = configuration |