Categories: None [Edit]

constrain

https://rubygems.org/gems/constrain
https://github.com/clrgit/constrain
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)

Total

Ranking: 38,433 of 197,085
Downloads: 34,695

Daily

Ranking: 11,442 of 197,066
Downloads: 41

Depended by

RankDownloadsName
18,007107,995prick
19,99690,383shellopts
55,11721,279pg_graph
75,37413,658fixture_fox
75,86313,522postspec
77,52613,099qrpm
79,11012,691modular_tree
170,2002,955sqlsnip
189,0461,073dumps

Depends on

RankDownloadsName
98505,778,426simplecov

Owners

#GravatarHandle
1iconclrgem