Class: Swagcov::Dotfile

Inherits:
Object
  • Object
show all
Defined in:
lib/swagcov/dotfile.rb

Constant Summary collapse

DEFAULT_CONFIG_FILE_NAME =
".swagcov.yml"

Instance Method Summary collapse

Constructor Details

#initialize(pathname: ::Rails.root.join(DEFAULT_CONFIG_FILE_NAME)) ⇒ Dotfile

Returns a new instance of Dotfile.



10
11
12
13
14
# File 'lib/swagcov/dotfile.rb', line 10

def initialize pathname: ::Rails.root.join(DEFAULT_CONFIG_FILE_NAME)
  @dotfile = load_yaml(pathname)

  raise BadConfigurationError, "Invalid config file (#{DEFAULT_CONFIG_FILE_NAME})" unless valid?
end

Instance Method Details

#doc_pathsObject



24
25
26
# File 'lib/swagcov/dotfile.rb', line 24

def doc_paths
  dotfile.dig("docs", "paths")
end

#ignore_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/swagcov/dotfile.rb', line 16

def ignore_path? path
  ignored_regex&.match?(path)
end

#only_path_mismatch?(path) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/swagcov/dotfile.rb', line 20

def only_path_mismatch? path
  only_regex && !only_regex.match?(path)
end