irb: rand(10..30) # create a random between a range
$ gem install awesome_print
irb: require 'ap'; ap [0,1,2]
x = 'string'; x['st'] # => 'st'
include A, B, C # include multiple modules in one line
ruby -c badfile.rb # => syntax error messages
c = 10; [*c] # => [10]
require 'json'; j my_hash # => { 'name' => 'aaron' }
''.length.source_location # => source location of the method
"my string".prepend 'aaron: ' # => "aaron: my string"
Created
June 26, 2013 14:33
-
-
Save agmcleod/5867848 to your computer and use it in GitHub Desktop.
Ruby trickshots
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment