Created
July 27, 2011 16:01
-
-
Save bemurphy/1109678 to your computer and use it in GitHub Desktop.
End the NotNot
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 fizzy?(string) | |
| string.match(/fizz/) | |
| end | |
| p fizzy?("foobar") # => nil | |
| p fizzy?("fizzbuzz") # => #<MatchData "fizz"> |
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 fizzy?(string) | |
| !!string.match(/fizz/) | |
| end | |
| p fizzy?("foobar") # => false | |
| p fizzy?("fizzbuzz") # => true |
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 fizzy?(string) | |
| true & string.match(/fizz/) | |
| end | |
| p fizzy?("foobar") # => false | |
| p fizzy?("fizzbuzz") # => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment