Class: Contracts::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/contracts.rb

Defined Under Namespace

Classes: Profile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/contracts.rb', line 70

def initialize
  @enabled = true
  @failure_mode = :raise
  @sample_rate = 1.0
  @logger = nil
  @include_values_in_errors = false
  @capture_source_locations = true
  @undeclared_exceptions = :ignore
  @invariant_checking = :contracted_methods
  @inheritance_mode = :merge

  @snapshot_strategy = :declared
  @sampler = nil
  @redacted_parameters = SENSITIVE_NAMES.dup
  @redactor = nil
  @check_invariant_after_exception = false
  @check_invariants_after_initialize = true

  @snapshot_provider = nil
  @allow_private_state_readers = true
  @unsupported_deep_copy = :reference
  @state_equality = :eql
  @verify_state_after_exception = false
  @allow_invariant_suppression = false
end

Instance Attribute Details

#allow_invariant_suppressionObject

Returns the value of attribute allow_invariant_suppression.



67
68
69
# File 'lib/contracts.rb', line 67

def allow_invariant_suppression
  @allow_invariant_suppression
end

#allow_private_state_readersObject

Returns the value of attribute allow_private_state_readers.



67
68
69
# File 'lib/contracts.rb', line 67

def allow_private_state_readers
  @allow_private_state_readers
end

#capture_source_locationsObject

Returns the value of attribute capture_source_locations.



67
68
69
# File 'lib/contracts.rb', line 67

def capture_source_locations
  @capture_source_locations
end

#check_invariant_after_exceptionObject

Returns the value of attribute check_invariant_after_exception.



67
68
69
# File 'lib/contracts.rb', line 67

def check_invariant_after_exception
  @check_invariant_after_exception
end

#check_invariants_after_initializeObject

Returns the value of attribute check_invariants_after_initialize.



67
68
69
# File 'lib/contracts.rb', line 67

def check_invariants_after_initialize
  @check_invariants_after_initialize
end

#enabledObject

Returns the value of attribute enabled.



67
68
69
# File 'lib/contracts.rb', line 67

def enabled
  @enabled
end

#failure_modeObject

Returns the value of attribute failure_mode.



67
68
69
# File 'lib/contracts.rb', line 67

def failure_mode
  @failure_mode
end

#include_values_in_errorsObject

Returns the value of attribute include_values_in_errors.



67
68
69
# File 'lib/contracts.rb', line 67

def include_values_in_errors
  @include_values_in_errors
end

#inheritance_modeObject

Returns the value of attribute inheritance_mode.



67
68
69
# File 'lib/contracts.rb', line 67

def inheritance_mode
  @inheritance_mode
end

#invariant_checkingObject

Returns the value of attribute invariant_checking.



67
68
69
# File 'lib/contracts.rb', line 67

def invariant_checking
  @invariant_checking
end

#loggerObject

Returns the value of attribute logger.



67
68
69
# File 'lib/contracts.rb', line 67

def logger
  @logger
end

#redacted_parametersObject

Returns the value of attribute redacted_parameters.



67
68
69
# File 'lib/contracts.rb', line 67

def redacted_parameters
  @redacted_parameters
end

#redactorObject

Returns the value of attribute redactor.



67
68
69
# File 'lib/contracts.rb', line 67

def redactor
  @redactor
end

#sample_rateObject

Returns the value of attribute sample_rate.



67
68
69
# File 'lib/contracts.rb', line 67

def sample_rate
  @sample_rate
end

#samplerObject

Returns the value of attribute sampler.



67
68
69
# File 'lib/contracts.rb', line 67

def sampler
  @sampler
end

#snapshot_providerObject

Returns the value of attribute snapshot_provider.



67
68
69
# File 'lib/contracts.rb', line 67

def snapshot_provider
  @snapshot_provider
end

#snapshot_strategyObject

Returns the value of attribute snapshot_strategy.



67
68
69
# File 'lib/contracts.rb', line 67

def snapshot_strategy
  @snapshot_strategy
end

#state_equalityObject

Returns the value of attribute state_equality.



67
68
69
# File 'lib/contracts.rb', line 67

def state_equality
  @state_equality
end

#undeclared_exceptionsObject

Returns the value of attribute undeclared_exceptions.



67
68
69
# File 'lib/contracts.rb', line 67

def undeclared_exceptions
  @undeclared_exceptions
end

#unsupported_deep_copyObject

Returns the value of attribute unsupported_deep_copy.



67
68
69
# File 'lib/contracts.rb', line 67

def unsupported_deep_copy
  @unsupported_deep_copy
end

#verify_state_after_exceptionObject

Returns the value of attribute verify_state_after_exception.



67
68
69
# File 'lib/contracts.rb', line 67

def verify_state_after_exception
  @verify_state_after_exception
end

Instance Method Details

#profile(_name) ⇒ Object



96
# File 'lib/contracts.rb', line 96

def profile(_name, &) = Profile.new(self).instance_eval(&)