Class: Swagcov::Dotfile
- Inherits:
-
Object
- Object
- Swagcov::Dotfile
- Defined in:
- lib/swagcov/dotfile.rb
Constant Summary collapse
- DEFAULT_CONFIG_FILE_NAME =
".swagcov.yml"
Instance Method Summary collapse
- #doc_paths ⇒ Object
- #ignore_path?(path) ⇒ Boolean
-
#initialize(pathname: ::Rails.root.join(DEFAULT_CONFIG_FILE_NAME)) ⇒ Dotfile
constructor
A new instance of Dotfile.
- #only_path_mismatch?(path) ⇒ Boolean
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_paths ⇒ Object
24 25 26 |
# File 'lib/swagcov/dotfile.rb', line 24 def doc_paths dotfile.dig("docs", "paths") end |
#ignore_path?(path) ⇒ 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
20 21 22 |
# File 'lib/swagcov/dotfile.rb', line 20 def only_path_mismatch? path only_regex && !only_regex.match?(path) end |