Skip to content

Instantly share code, notes, and snippets.

@paulghaddad
Last active August 29, 2015 14:07
Show Gist options
  • Save paulghaddad/a39a1eac55fd8173959d to your computer and use it in GitHub Desktop.
Save paulghaddad/a39a1eac55fd8173959d to your computer and use it in GitHub Desktop.
Level Up 2: Knows how to find documentation for Ruby and Rails classes
Ruby core has so many more methods than you'll ever keep in your head. That's totally fine, but you need to know how to look up and use those functions. Use the ruby docs to find the docs for the String class. There's a method that lets you substitute a bunch of characters for a corresponding set of characters (it's not gsub). Find that method and use it in a code sample.
"My name is Paul Haddad, and I am from Columbus!".sub(/Columbus/, 'Chicago')
=> "My name is Paul Haddad, and I am from Chicago!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment