Class: Qcourses::Course
- Inherits:
-
Object
- Object
- Qcourses::Course
- Defined in:
- lib/qcourses/models/course.rb
Instance Attribute Summary collapse
-
#identification ⇒ Object
readonly
Returns the value of attribute identification.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#subtitle ⇒ Object
readonly
Returns the value of attribute subtitle.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(attributes = {}) ⇒ Course
constructor
A new instance of Course.
- #inspect ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Course
Returns a new instance of Course.
4 5 6 7 8 |
# File 'lib/qcourses/models/course.rb', line 4 def initialize(attributes = {}) @identification = attributes[:identification] @name = attributes[:name] @subtitle = attributes[:subtitle] end |
Instance Attribute Details
#identification ⇒ Object (readonly)
Returns the value of attribute identification.
3 4 5 |
# File 'lib/qcourses/models/course.rb', line 3 def identification @identification end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/qcourses/models/course.rb', line 3 def name @name end |
#subtitle ⇒ Object (readonly)
Returns the value of attribute subtitle.
3 4 5 |
# File 'lib/qcourses/models/course.rb', line 3 def subtitle @subtitle end |
Class Method Details
.default_attributes(course_identification) ⇒ Object
10 11 12 |
# File 'lib/qcourses/models/course.rb', line 10 def self.default_attributes(course_identification) {identification: course_identification, name: course_identification, subtitle: ''} end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/qcourses/models/course.rb', line 18 def ==(other) other.is_a?(Course) && other.identification == identification end |
#eql?(other) ⇒ Boolean
22 23 24 |
# File 'lib/qcourses/models/course.rb', line 22 def eql?(other) self == other end |
#hash ⇒ Object
26 27 28 |
# File 'lib/qcourses/models/course.rb', line 26 def hash identification.hash end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/qcourses/models/course.rb', line 14 def inspect "Course<#{identification}, #{name}>" end |