Categories: None [Edit]
    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: 41,415 of 187,571
          Downloads: 28,345
        Daily
Ranking: 19,104 of 187,548
          Downloads: 25
        Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
| Rank | Downloads | Name | 
|---|---|---|
| 19,527 | 81,980 | prick | 
| 21,661 | 69,569 | shellopts | 
| 59,119 | 17,557 | pg_graph | 
| 82,206 | 10,846 | fixture_fox | 
| 83,757 | 10,522 | modular_tree | 
| 84,247 | 10,416 | qrpm | 
| 87,213 | 9,816 | postspec | 
| 176,108 | 2,002 | sqlsnip | 
| 182,351 | 837 | dumps | 
Depends on
| Rank | Downloads | Name | 
|---|---|---|
| 98 | 425,116,291 | simplecov | 
Owners
| # | Gravatar | Handle | 
|---|---|---|
| 1 | clrgem | 
 xmisao
xmisao