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)

Gemfile:
= 复制到剪贴板 已复制!

安装:
=

版本列表:

  1. 0.10.0 - December 18, 2023 (10.5 KB)
  2. 0.9.0 - January 21, 2023 (10.0 KB)
  3. 0.8.0 - September 17, 2022 (10.0 KB)
  4. 0.7.0 - September 03, 2022 (10.0 KB)
  5. 0.6.0 - July 20, 2022 (10.0 KB)
  6. 0.5.1 - March 06, 2022 (10.0 KB)
显示所有版本 (共 19 个)

Development 依赖 (1):

simplecov >= 0

业主:

推送:

作者:

  • Claus Rasmussen

SHA 256 校验和:

a9ba558c8c5f7b1e8f43344109ad57ceca94d3d9b330d30f6b6725808542f93e

下载总量 21,773

这个版本 1,262

许可:

需要的 Ruby 版本: >= 2.3.0

链接: