Class: Qcourses::Course

Inherits:
Object
  • Object
show all
Defined in:
lib/qcourses/models/course.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#identificationObject (readonly)

Returns the value of attribute identification.



3
4
5
# File 'lib/qcourses/models/course.rb', line 3

def identification
  @identification
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/qcourses/models/course.rb', line 3

def name
  @name
end

#subtitleObject (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

Returns:

  • (Boolean)


22
23
24
# File 'lib/qcourses/models/course.rb', line 22

def eql?(other)
  self == other 
end

#hashObject



26
27
28
# File 'lib/qcourses/models/course.rb', line 26

def hash
  identification.hash
end

#inspectObject



14
15
16
# File 'lib/qcourses/models/course.rb', line 14

def inspect
  "Course<#{identification}, #{name}>"
end