Created
          January 19, 2012 23:42 
        
      - 
      
- 
        Save dnch/1643764 to your computer and use it in GitHub Desktop. 
    Ode To The Splat Operator
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def test_exclusions(str) | |
| exclusions = ['a', /^I-/] | |
| case str | |
| when *exclusions then | |
| "Excluded" | |
| else | |
| "Accepted" | |
| end | |
| end | |
| test_exclusions("a") # => "Excluded" | |
| test_exclusions("b") # => "Accepted" | |
| test_exclusions("I-34") # => "Excluded" | |
| test_exclusions("x-34") # => "Accepted" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment