Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Ruby Classes1:27 with Jason Seifer
As we’ve been going along learning Ruby, we’ve been working with various types — numbers, strings, arrays, and hashes. Ruby calls these things classes. In this video, we'll learn a bit about what classes are and how to use them.
[MUSIC] 0:00 As we've been going along learning Ruby, we've been working with various types. 0:04 Numbers, strings, arrays, and hashes. 0:09 We haven't gotten too far along into what they actually are under the hood though. 0:13 Although we've been calling these types, Ruby calls these things classes. 0:18 The types that we've been using so far are all built into Ruby and 0:23 come along with it when you download or install Ruby as part of Ruby's core API. 0:27 We're not limited to working only with the built in classes that 0:34 Ruby provides for us. 0:37 We can also create our own. 0:39 Why would we wanna do this? 0:41 Well, I'm so glad you asked. 0:43 As we're going along creating a program, 0:45 it can be cumbersome to remember each small nuanced part of 0:47 what we're working with and remember those parts in terms that computers understand. 0:50 We start to abstract that away using representations of 0:56 things we're used to in the real world. 0:59 These representations are called classes. 1:03 You can think of a class as a blueprint. 1:07 The blueprint tells Ruby how a class should be structured and 1:09 what it should do. 1:14 For example, a blueprint of a car would show how a car can be made. 1:15 What it doesn't do is get into the specific details about an individual car, 1:21 like the color. 1:26
You need to sign up for Treehouse in order to download course files.Sign up