Module: Taipo

Defined in:
lib/taipo.rb,
lib/taipo/cache.rb,
lib/taipo/check.rb,
lib/taipo/parser.rb,
lib/taipo/result.rb,
lib/taipo/version.rb,
lib/taipo/utilities.rb,
lib/taipo/exceptions.rb,
lib/taipo/refinements.rb,
lib/taipo/parser/stack.rb,
lib/taipo/type_element.rb,
lib/taipo/type_elements.rb,
lib/taipo/parser/validater.rb,
lib/taipo/parser/syntax_state.rb,
lib/taipo/exceptions/name_error.rb,
lib/taipo/exceptions/type_error.rb,
lib/taipo/type_element/children.rb,
lib/taipo/exceptions/syntax_error.rb,
lib/taipo/type_element/constraint.rb,
lib/taipo/type_element/constraints.rb

Overview

A library for checking the types of objects

Taipo is primarily intended as a replacement for verbose, error-prone guard statements. With Taipo, a user can ensure that the objects they are working with conform to expectations.

Taipo consists of two user-facing parts: Check and Result.

Taipo provides a rich syntax to express type definitions. This includes classes, collections, optionals and duck types. See Parser::Validater for the full syntax.

See Also:

Since:

  • 1.0.0

Defined Under Namespace

Modules: Cache, Check, Parser, Refinements, Result, Utilities Classes: NameError, SyntaxError, TypeElement, TypeElements, TypeError

Constant Summary collapse

VERSION =

Since:

  • 1.0.0

"1.5.0"
@@alias =

This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.

The setting for whether Kernel#binding should be aliased with the keyword types.

Since:

  • 1.1.0

true

Class Method Summary collapse

Class Method Details

.alias=(v) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set whether Kernel#binding should be aliased with the keyword types. Note that this will be reset to true whenever Check is extended or included.

Parameters:

  • v (Boolean)

    Whether to alias

Raises:

  • (::TypeError)

Since:

  • 1.1.0



44
45
46
47
48
49
# File 'lib/taipo.rb', line 44

def self.alias=(v)
  msg = "The argument to this method must be a Boolean."
  raise ::TypeError, msg unless v.is_a?(TrueClass) || v.is_a?(FalseClass)

  @@alias = v
end

.alias?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check whether Kernel#binding should be aliased with the keyword types.

Returns:

  • (Boolean)

    the result

Since:

  • 1.1.0



57
58
59
# File 'lib/taipo.rb', line 57

def self.alias?
  @@alias
end