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.
-
By including the module Check, a user can call Check#check or Check#review in their methods to check the types of one or more given variables.
-
By including the module Result, a user can call Result::ClassMethods#result in their class definitions to check the return values of a given method.
Taipo provides a rich syntax to express type definitions. This includes classes, collections, optionals and duck types. See Parser::Validater for the full syntax.
Defined Under Namespace
Modules: Cache, Check, Parser, Refinements, Result, Utilities Classes: NameError, SyntaxError, TypeElement, TypeElements, TypeError
Constant Summary collapse
- VERSION =
"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
. true
Class Method Summary collapse
-
.alias=(v) ⇒ Object
private
Set whether Kernel#binding should be aliased with the keyword
types
. -
.alias? ⇒ Boolean
private
Check whether Kernel#binding should be aliased with the keyword
types
.
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.
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
.
57 58 59 |
# File 'lib/taipo.rb', line 57 def self.alias? @@alias end |