sinatra's songs
Blueprinting objects with Ruby Classes
Github Repository: https://github.com/ga-chicago/sinatras_songs
This is a pair or group exercise. Students will compare Javsascript Constructors to Ruby Classes. Students are expected to have been introduced to the topic of Classes in Ruby and will now use their prior Javascript knowledge to understand Ruby. Further reading on classes may be found here. An interactive diagram is available, too.
Exercise: Javascript to Ruby
- Inspect the
song.json
file in this repository. Identify the data that has been modelled. - Read the
Song.js
file in this repository. Describe the function of it and how to instantiate a new thing. - Read the
song.rb
fine in this repository. Compare theSong.js
to thesong.rb
. - What differences do you notice?
Exercise: Artist
- Repeat the above steps for
Artist.js
andartist.rb
.
Practice: Game Object
During your first project, you created a game. You will now create Ruby classes (and test them using pry
or irb
)! You should aim to create a Player and a Score. Each class should contain at least a constructor method (initialize
).