Module: Brine::TypeChecking

Included in:
Brine
Defined in:
lib/brine/type_checking.rb

Overview

Support asserting the type of values.

Defined Under Namespace

Classes: TypeChecks

Instance Method Summary collapse

Instance Method Details

#type_check_for(type) ⇒ RSpec::Matcher

Return the Matcher for the specified type.

This is the primary interface for type_checking to the rest of the system, and is the only one expected to be used during test execution.

Parameters:

  • type (Class)

    Specify the type for which a Matcher should be returned.

Returns:

  • (RSpec::Matcher)

    Return the Matcher currently registered for the type.



79
80
81
# File 'lib/brine/type_checking.rb', line 79

def type_check_for(type)
  type_checks.for_type(type)
end

#type_checksObject

Expose the currently active TypeCheck instance as a property, instantiating as needed.



65
66
67
# File 'lib/brine/type_checking.rb', line 65

def type_checks
  @type_check ||= TypeChecks.new
end