(gentle chime music)…- [Instructor] Hopefully you were able to complete…the dice challenge assignment.…In this movie, I'm going to show you…the solution that I came up with.…So the first thing I want to show you…is the file structure that I used.…I followed the same structure we used for our ruby project,…I have an init.rb file which is my main script.…It could have been called anything…but this is kind of a ruby convention,…loose convention to call it init.…So that's the one that's going to initialize things…and start the script running.…Then I've got my classes directory…and inside there I've got dice.rb and dice_set.rb.…
So first let's take a look at dice,…let's get a single dice working.…So we have a class, it's called Dice.…We know how to name our classes, uppercase D…and it's a singular noun.…I'm using an attribute reader for the value.…So I can always look at a dice…and I can see what it's value is.…Anyone outside the class can ask a dice for its value.…When we initially create a dice,…we're going to call the initialize method.…
- Defining a custom class
- Working with instances of a class
- Class and instance attributes and methods
- Class inheritance
- Working with dates and times
- Using modules as namespaces and mixins
- Raising and handling exceptions
Skill Level Beginner
2. Class Attributes and Methods
4. Dates and Times
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.