Ruby Intermediate Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

class

A

tell Ruby to make a new kind of thing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

object

A

two meanings: the most basic kind of thing, any instance of something

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

instance

A

What you get when you tell Ruby to create a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

def

A

how you define a function inside of a class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

@

A

Inside the function of a class, @ is a operator for variables in the instance/object being accessed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

inheritance

A

The concept that one class can inherit traits from another class much like you and your parents

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

composition

A

The concept that a class can be composed of other classes as parts, much like how a car has wheels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

attribute

A

A property classes have that are from composition and are usually variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

is-a

A

A phrase to say that something inherits from another, as in a salmon is a fish

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

has-a

A

a phrase to say that something is composed of other things or has a trait, as in salmon has a mouth

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

class X(Y)

A

Make a class named X that is-a Y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Class X(Object) def initialize(J)

A

class X has-a initialize that takes J parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

class x(object) def M(J)

A

class X has-a function named M that takes J parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

foo = x()

A

Set foo to an instance of class X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

foo.M(J)

A

class X has-a function named M that takes J parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

foo.K = Q

A

From foo get the K attribute and set it to Q