Taipo::Check#check

Parsed documentation:
View on GitHub
Check whether the given arguments match the given type definition in the
given context

@param context [Binding] the context in which the arguments to be checked
  are defined
@param collect_invalids [Boolean] whether to raise an exception for, or
  collect, an argument that doesn't match its type definition
@param checks [Hash] the arguments to be checked written as +Symbol:
  String+ pairs with the Symbol being the name of the argument and the
  String being its type definition

@return [Array] the arguments which don't match (ie. an empty array if
  all arguments match)

@raise [::TypeError] if the context is not a Binding
@raise [Taipo::SyntaxError] if the type definitions in +checks+ are
  invalid
@raise [Taipo::TypeError] if the arguments in +checks+ don't match the
  given type definition

@since 1.0.0

@example
  require 'taipo'

  class A
    include Taipo::Check

    def foo(str)
      check types, str: 'String'
      puts str
    end

    def bar(str)
      check types, str: 'Integer'
      puts str
    end
  end

  a = A.new()
  a.foo('Hello world!')     #=> "Hello world!"
  a.bar('Goodbye world!')   #=> Taipo::TypeError
No suggestions.
Please help! Open an issue on GitHub if this assessment is incorrect.