- What is a class?
- What is an object?
- What is a module? Can you tell me the difference between classes and modules?
- Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
- There are three ways to invoke a method in ruby. Can you give me at least two?
- Explain this ruby idiom: a ||= b
- What does self mean?
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
# See http://help.github.com/ignore-files/ for more about ignoring files. | |
# | |
# If you find yourself ignoring temporary files generated by your text editor | |
# or operating system, you probably want to add a global ignore instead: | |
# git config --global core.excludesfile ~/.gitignore_global | |
*.rbc | |
*.sassc | |
.sass-cache | |
capybara-*.html |
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
require 'spec_helper' | |
describe SessionsController do | |
describe "POST .create" do | |
it "redirects to profile after authorization" do | |
user = double('user', id: 1) | |
User.stub(:from_omniauth).and_return(user) | |
post :create | |
expect(response).to redirect_to profile_path |
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
nba_teams = [{"mascot"=>"Thunder", "city"=>"OKC"}, {"mascot"=>"Heat", "city"=>"Heat"}, {"mascot"=>"Knicks", "city"=>"NYC"}, {"mascot"=>"Nets", "city"=>"Brooklyn"}] |
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
[{:us_state=>"Alabama", :state_capital=>"Montgomery", :population=>"4822023"}, | |
{:us_state=>"Alaska", :state_capital=>"Juneau", :population=>"731449"}, | |
{:us_state=>"Arizona", :state_capital=>"Phoenix", :population=>"6553255"}, | |
{:us_state=>"Arkansas", | |
:state_capital=>"Little Rock", | |
:population=>"2949131"}, | |
{:us_state=>"California", | |
:state_capital=>"Sacramento", | |
:population=>"38041430"}, | |
{:us_state=>"Colorado", :state_capital=>"Denver", :population=>"5187582"}, |
This exercise will help you better understand Arrays and Hashes
Use the data provided in state_capitals.rb to write a program that does the following.
-
Prints out the names of all states that have a population greater than 5 million.
-
Returns the name of the capital when given the name of the state.
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
{ | |
"auto_match_enabled" : true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme", | |
"draw_white_space": "all", | |
"folder_exclude_patterns": [".git"], | |
"font_face": "Courier New", | |
"font_size": 14.0, | |
"ignored_packages": | |
[ |
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
<h1>users#index</h1> | |
<p>Find me in app/views/users/index.html.erb</p> | |
<% @users.each do |user| %> | |
<p> | |
<%= user.first_name %> | |
<%= user.last_name %> | |
<%= link_to "Delete This User", user_path(user), method: :delete, data: {confirm: "Are you sure you want to delete this user?"} %> | |
</p> | |
<% end %> |
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
<h1>users#index</h1> | |
<p>Find me in app/views/users/index.html.erb</p> | |
<% @users.each do |user| %> | |
<p> | |
<%= user.first_name %> | |
<%= user.last_name %> | |
<%= link_to "Delete This User", user_path(user), method: :delete, data: {confirm: "Are you sure you want to delete this user?"} %> | |
</p> | |
<% end %> |
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
<h1>Here's some info about one user:</h1> | |
<ul> | |
<li>Id: <%= @user.id %></li> | |
<li>Name: <%= @user.name %></li> | |
<li>Email: <%= @user.email %></li> | |
<li>Phone: <%= @user.phone %></li> | |
</ul> | |
<h3>Posts</h3> |