Class: Curricula::Course

Inherits:
Object
  • Object
show all
Defined in:
lib/curricula.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, hours) ⇒ Course

Returns a new instance of Course.



11
12
13
14
15
16
# File 'lib/curricula.rb', line 11

def initialize name, hours
  @name = name
  @hours = hours
  @prereqs = [] 
  @cruciality = 0
end

Instance Attribute Details

#crucialityObject

Returns the value of attribute cruciality.



9
10
11
# File 'lib/curricula.rb', line 9

def cruciality
  @cruciality
end

#hoursObject (readonly)

Returns the value of attribute hours.



8
9
10
# File 'lib/curricula.rb', line 8

def hours
  @hours
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/curricula.rb', line 8

def name
  @name
end

#prereqsObject

Returns the value of attribute prereqs.



9
10
11
# File 'lib/curricula.rb', line 9

def prereqs
  @prereqs
end

Instance Method Details

#graph_edgesObject



18
19
20
# File 'lib/curricula.rb', line 18

def graph_edges
  prereqs.map{ |prereq| { source: prereq.name, destination: name } }
end