Module: Strict

Defined in:
lib/strict.rb,
lib/strict/error.rb,
lib/strict/value.rb,
lib/strict/method.rb,
lib/strict/object.rb,
lib/strict/return.rb,
lib/strict/version.rb,
lib/strict/attribute.rb,
lib/strict/interface.rb,
lib/strict/parameter.rb,
lib/strict/methods/dsl.rb,
lib/strict/coercers/hash.rb,
lib/strict/configuration.rb,
lib/strict/dsl/coercible.rb,
lib/strict/reader/module.rb,
lib/strict/attributes/dsl.rb,
lib/strict/coercers/array.rb,
lib/strict/methods/module.rb,
lib/strict/accessor/module.rb,
lib/strict/dsl/validatable.rb,
lib/strict/assignment_error.rb,
lib/strict/attributes/class.rb,
lib/strict/method_call_error.rb,
lib/strict/reader/attributes.rb,
lib/strict/validators/all_of.rb,
lib/strict/validators/any_of.rb,
lib/strict/attributes/coercer.rb,
lib/strict/interfaces/coercer.rb,
lib/strict/validators/boolean.rb,
lib/strict/validators/hash_of.rb,
lib/strict/accessor/attributes.rb,
lib/strict/attributes/instance.rb,
lib/strict/interfaces/instance.rb,
lib/strict/method_return_error.rb,
lib/strict/validators/anything.rb,
lib/strict/validators/array_of.rb,
lib/strict/validators/range_of.rb,
lib/strict/initialization_error.rb,
lib/strict/methods/configuration.rb,
lib/strict/method_definition_error.rb,
lib/strict/attributes/configuration.rb,
lib/strict/methods/verifiable_method.rb,
lib/strict/implementation_does_not_conform_error.rb

Defined Under Namespace

Modules: Accessor, Attributes, Coercers, Dsl, Interface, Interfaces, Method, Methods, Object, Reader, Validators, Value Classes: AssignmentError, Attribute, Configuration, ImplementationDoesNotConformError, InitializationError, MethodCallError, MethodDefinitionError, MethodReturnError, Parameter, Return

Constant Summary collapse

ISSUE_TRACKER =
"https://github.com/kylekthompson/strict/issues"
Error =
Class.new(StandardError)
VERSION =
"1.5.0"

Class Method Summary collapse

Class Method Details

.configurationObject



11
12
13
# File 'lib/strict.rb', line 11

def configuration
  thread_configuration || global_configuration
end

.configure {|configuration| ... } ⇒ Object

Yields:

Raises:



15
16
17
18
19
# File 'lib/strict.rb', line 15

def configure
  raise Strict::Error, "cannot reconfigure overridden configuration" if overridden?

  yield(configuration)
end

.with_overrides(**overrides) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/strict.rb', line 21

def with_overrides(**overrides)
  original_thread_configuration = thread_configuration

  begin
    self.thread_configuration = Strict::Configuration.new(**configuration.to_h.merge(overrides))
    yield
  ensure
    self.thread_configuration = original_thread_configuration
  end
end