Class: GherkinLint::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin_lint/configuration.rb

Overview

gherkin_lint configuration object

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (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_pathObject



13
14
15
# File 'lib/gherkin_lint/configuration.rb', line 13

def configuration_path
  @path
end

#load_configurationObject



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_configurationObject



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