Class: ArchUnit::Common::FluentApi::CheckOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/common/fluentapi/check_options.rb

Overview

Immutable options shared by every terminal rule check.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_empty_tests: false, logging: nil, clear_cache: false, load_paths: []) ⇒ CheckOptions

Returns a new instance of CheckOptions.



17
18
19
20
21
22
23
# File 'lib/archunit/common/fluentapi/check_options.rb', line 17

def initialize(allow_empty_tests: false, logging: nil, clear_cache: false, load_paths: [])
  validate_boolean(allow_empty_tests, :allow_empty_tests)
  validate_logging(logging)
  validate_boolean(clear_cache, :clear_cache)
  load_paths = immutable_load_paths(load_paths)
  super
end

Instance Attribute Details

#allow_empty_tests ⇒ Object (readonly)

Returns the value of attribute allow_empty_tests

Returns:

  • (Object) —

    the current value of 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

Returns:

  • (Object) —

    the current value of clear_cache



9
10
11
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9

def clear_cache
  @clear_cache
end

#load_paths ⇒ Object (readonly)

Returns the value of attribute load_paths

Returns:

  • (Object) —

    the current value of 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

Returns:

  • (Object) —

    the current value of logging



9
10
11
# File 'lib/archunit/common/fluentapi/check_options.rb', line 9

def logging
  @logging
end

Class Method Details

.resolve(value) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
# File 'lib/archunit/common/fluentapi/check_options.rb', line 10

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:

  • (Boolean)


25
26
27
# File 'lib/archunit/common/fluentapi/check_options.rb', line 25

def allow_empty_tests?
  allow_empty_tests
end

#clear_cache? ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/archunit/common/fluentapi/check_options.rb', line 29

def clear_cache?
  clear_cache
end