Class: ArchUnit::Common::FluentApi::CheckOptions
- Inherits:
-
Data
- Object
- Data
- ArchUnit::Common::FluentApi::CheckOptions
- Defined in:
- lib/archunit/common/fluentapi/check_options.rb
Overview
Immutable options shared by every terminal rule check.
Instance Attribute Summary collapse
-
#allow_empty_tests ⇒ Object
readonly
Returns the value of attribute allow_empty_tests.
-
#clear_cache ⇒ Object
readonly
Returns the value of attribute clear_cache.
-
#dependency_analysis ⇒ Object
readonly
Returns the value of attribute dependency_analysis.
-
#load_paths ⇒ Object
readonly
Returns the value of attribute load_paths.
-
#logging ⇒ Object
readonly
Returns the value of attribute logging.
Class Method Summary collapse
-
.resolve(value) ⇒ CheckOptions
Normalizes nil or an existing options value for terminal execution.
Instance Method Summary collapse
-
#allow_empty_tests? ⇒ Boolean
Whether an empty subject selection is allowed.
-
#clear_cache? ⇒ Boolean
Whether this check rebuilds the cached graph.
-
#constant_references? ⇒ Boolean
-
#initialize(allow_empty_tests: false, logging: nil, clear_cache: false, load_paths: [], dependency_analysis: :imports) ⇒ CheckOptions
constructor
A new instance of CheckOptions.
Constructor Details
#initialize(allow_empty_tests: false, logging: nil, clear_cache: false, load_paths: [], dependency_analysis: :imports) ⇒ CheckOptions
Returns a new instance of CheckOptions.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 27 def initialize( allow_empty_tests: false, logging: nil, clear_cache: false, load_paths: [], dependency_analysis: :imports ) validate_boolean(allow_empty_tests, :allow_empty_tests) validate_logging(logging) validate_boolean(clear_cache, :clear_cache) load_paths = immutable_load_paths(load_paths) unless %i[imports imports_and_constants].include?(dependency_analysis) raise ArgumentError, 'dependency_analysis must be :imports or :imports_and_constants' end super end |
Instance Attribute Details
#allow_empty_tests ⇒ Object (readonly)
Returns the value of attribute allow_empty_tests
9 10 11 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9 def allow_empty_tests @allow_empty_tests end |
#clear_cache ⇒ Object (readonly)
Returns the value of attribute clear_cache
9 10 11 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9 def clear_cache @clear_cache end |
#dependency_analysis ⇒ Object (readonly)
Returns the value of attribute dependency_analysis
9 10 11 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9 def dependency_analysis @dependency_analysis end |
#load_paths ⇒ Object (readonly)
Returns the value of attribute load_paths
9 10 11 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9 def load_paths @load_paths end |
#logging ⇒ Object (readonly)
Returns the value of attribute logging
9 10 11 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9 def logging @logging end |
Class Method Details
.resolve(value) ⇒ CheckOptions
Normalizes nil or an existing options value for terminal execution.
15 16 17 18 19 20 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 15 def self.resolve(value) return new if value.nil? return value if value.is_a?(self) raise ArgumentError, 'options must be a CheckOptions value or nil' end |
Instance Method Details
#allow_empty_tests? ⇒ Boolean
Returns whether an empty subject selection is allowed.
43 44 45 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 43 def allow_empty_tests? allow_empty_tests end |
#clear_cache? ⇒ Boolean
Returns whether this check rebuilds the cached graph.
48 49 50 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 48 def clear_cache? clear_cache end |
#constant_references? ⇒ Boolean
52 53 54 |
# File 'lib/archunit/common/fluentapi/check_options.rb', line 52 def constant_references? dependency_analysis == :imports_and_constants end |
ArchUnitRuby