Class: GherkinLint::Configuration
- Inherits:
-
Object
- Object
- GherkinLint::Configuration
- Defined in:
- lib/gherkin_lint/configuration.rb
Overview
gherkin_lint configuration object
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #configuration_path ⇒ Object
-
#initialize(path) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_configuration ⇒ Object
- #load_user_configuration ⇒ Object
Constructor Details
#initialize(path) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 |
# File 'lib/gherkin_lint/configuration.rb', line 7 def initialize(path) @path = path @config = load_configuration || '' load_user_configuration end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/gherkin_lint/configuration.rb', line 5 def config @config end |
Instance Method Details
#configuration_path ⇒ Object
13 14 15 |
# File 'lib/gherkin_lint/configuration.rb', line 13 def configuration_path @path end |
#load_configuration ⇒ Object
17 18 19 |
# File 'lib/gherkin_lint/configuration.rb', line 17 def load_configuration YAML.load_file configuration_path || '' if File.exist? configuration_path end |
#load_user_configuration ⇒ Object
21 22 23 24 |
# File 'lib/gherkin_lint/configuration.rb', line 21 def load_user_configuration config_file = Dir.glob(File.join(Dir.pwd, '**', '.gherkin_lint.yml')).first merge_config(config_file) if !config_file.nil? && File.exist?(config_file) end |