Class: Movie
- Inherits:
-
Object
- Object
- Movie
- Includes:
- Comparable
- Defined in:
- lib/modules/topics/demos/lib/movie.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(title, description) ⇒ Movie
constructor
A new instance of Movie.
- #to_s ⇒ Object
Constructor Details
#initialize(title, description) ⇒ Movie
Returns a new instance of Movie.
8 9 10 11 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 8 def initialize(title, description) @title = title @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 6 def description @description end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 6 def title @title end |
Class Method Details
.all ⇒ Object
21 22 23 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 21 def self.all ObjectSpace.each_object(self).to_a end |
.count ⇒ Object
25 26 27 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 25 def self.count all.count end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 17 def <=>(other) @title <=> other.title end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/modules/topics/demos/lib/movie.rb', line 13 def to_s "#{@title}" end |