Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Last active December 17, 2015 20:19
Show Gist options
  • Save ashleygwilliams/5667062 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/5667062 to your computer and use it in GitHub Desktop.
Notes from class, 28 May 2013
Classes are blueprints. Objects are known as 'instances' of these classes.
Classes are where we define all variables and methods.
Instance variables (@var_name) and instance methods (def method_name) belong only to objects and are accessed using dot notation (Object.name) on an object made using 'Class.new'.
Class variables (var_name)
, constants (VAR_NAME), and class methods (def self.method_name) belong only to the class and are accessed using 'Class::name'
To add a new basic route, go to app.rb and add a block that does this:
get '/pathname' do
erb :view_filename
end
@ashleygwilliams
Copy link
Author

//HOMEWORK

  1. create a class method called count projects
  2. create a class variable called count
  3. make the class method add 1 to count for everytime initialize is called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment