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: 43,890 of 183,477
Downloads: 24,152

Daily

Ranking: 11,043 of 183,470
Downloads: 15

Depended by

RankDownloadsName
21,42664,199prick
23,02157,750shellopts
64,45314,361pg_graph
90,1498,552modular_tree
91,3568,366qrpm
102,4566,954fixture_fox
114,4085,622postspec
177,5071,030sqlsnip
180,044580dumps

Depends on

RankDownloadsName
98353,748,210simplecov

Owners

#GravatarHandle
1iconclrgem