RubyGems Navigation menu

constrain 0.5.1

Allows you check if an object match a class expression. It is typically used to check the type of method paraameters. It is an alternative to using Ruby-3 .rbs files but with a different syntax and only dynamic checks Typically you'll include the Constrain module and use #constrain to check the type of method parameters: include Constrain # f takes a String and an array of Integer objects. Raise a Constrain::Error # if parameters doesn't have the expected types def f(a, b) constrain a, String constrain b, [Integer] end Constrain works with ruby-2 (and maybe ruby-3)

Versions:

  1. 0.5.1 - March 06, 2022 (10 KB)
  2. 0.5.0 - March 06, 2022 (10 KB)
  3. 0.4.0 - March 03, 2022 (10 KB)
  4. 0.3.3 - January 21, 2022 (10 KB)
  5. 0.3.2 - October 24, 2021 (10 KB)
Show all versions (14 total)

Development Dependencies (1):

Owners:

Pushed by:

Authors:

  • Claus Rasmussen

SHA 256 checksum:

a9ba558c8c5f7b1e8f43344109ad57ceca94d3d9b330d30f6b6725808542f93e

Total downloads 11,830

For this version 688

Gemfile:
= Copy to clipboard Copied!

install:
=

Licenses:

N/A

Required Ruby Version: >= 2.3.0

Links: