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) ⇒ CheckOptions

Returns a new instance of CheckOptions.



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

def initialize(allow_empty_tests: false, logging: nil, clear_cache: false)
  validate_boolean(allow_empty_tests, :allow_empty_tests)
  validate_logging(logging)
  validate_boolean(clear_cache, :clear_cache)
  super
end

Instance Attribute Details

#allow_empty_testsObject (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_cacheObject (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

#loggingObject (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)


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

def allow_empty_tests?
  allow_empty_tests
end

#clear_cache?Boolean

Returns:

  • (Boolean)


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

def clear_cache?
  clear_cache
end