Created
January 5, 2016 19:01
-
-
Save systemnate/13d45f37abd8b11e0c8d to your computer and use it in GitHub Desktop.
Ruby Toolbox
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
Ruby Version Manager | |
rvm list # - View available ruby versions | |
rvm use 2.3.0 # - Use version 2.3.0 (if installed) | |
rvm install 2.3.0 # - Install version 2.3.0 (if not installed) | |
----------------- | |
String methods | |
----------------- | |
"hello".capitalize # => "Hello" | |
"nxte dxlo".gsub('x','a') # => "nate dalo" | |
"a".succ # => "b" | |
----------------- | |
Array methods | |
----------------- | |
[1,2,3].inject(:+) # => 6 | |
[1,2,3].map(&:to_s) # => ["1", "2", "3"] | |
[1,2,3,[4,5,6]].flatten # => [1, 2, 3, 4, 5, 6] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment