Created
January 17, 2012 05:59
-
-
Save vinniefranco/1625078 to your computer and use it in GitHub Desktop.
This file contains 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
# Cool shit about Ruby | |
# Arrays | |
array1, array2 = %w{ x y z }, %w{ w y z } | |
array1 | array2 ###(Union) #=> ["x", "y", "z", "w"] | |
array1 & array2 ###(Intersect) #=> ["y", "z"] | |
array1 - array2 ###(Difference) #=> ["x"] | |
# Strings | |
str = %{I'd like to invite you to the pants party} | |
str['to the pants'] = %{80's} | |
# Chicks love 80's parties. | |
str #=> "I'd like to invite you 80's party" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment