module Taipo

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: {Taipo::Check} and {Taipo::Result}.

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

@since 1.0.0 @see github.com/pyrmont/taipo

Constants

VERSION

Public Class Methods

alias=(v) click to toggle source

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

@param v [Boolean] Whether to alias

@since 1.1.0 @api private

# 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?() click to toggle source

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

@return [Boolean] the result

@since 1.1.0 @api private

# File lib/taipo.rb, line 57
def self.alias?
  @@alias
end