Class: Poly::Course
- Inherits:
-
Object
- Object
- Poly::Course
- Defined in:
- lib/polyhoraire/course.rb
Instance Attribute Summary collapse
-
#acronym ⇒ Object
Returns the value of attribute acronym.
-
#creditNbr ⇒ Object
Returns the value of attribute creditNbr.
-
#group ⇒ Object
Returns the value of attribute group.
-
#labGroup ⇒ Object
Returns the value of attribute labGroup.
-
#name ⇒ Object
Returns the value of attribute name.
-
#periods ⇒ Object
readonly
Returns the value of attribute periods.
-
#professor ⇒ Object
Returns the value of attribute professor.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#acronym ⇒ Object
Returns the value of attribute acronym.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def acronym @acronym end |
#creditNbr ⇒ Object
Returns the value of attribute creditNbr.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def creditNbr @creditNbr end |
#group ⇒ Object
Returns the value of attribute group.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def group @group end |
#labGroup ⇒ Object
Returns the value of attribute labGroup.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def labGroup @labGroup end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def name @name end |
#periods ⇒ Object (readonly)
Returns the value of attribute periods.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def periods @periods end |
#professor ⇒ Object
Returns the value of attribute professor.
7 8 9 |
# File 'lib/polyhoraire/course.rb', line 7 def professor @professor end |
Class Method Details
.from_nokogiri(doc) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/polyhoraire/course.rb', line 10 def self.from_nokogiri(doc) courses = Array.new nodeSet = doc.xpath("//cour") nodeSet.each do |node| course = self.new course.acronym = node.attribute("sigle").text course.name = node.xpath("nom").text course.professor = node.xpath("prof").text course.group = node.xpath("groupeTheorie").text course.labGroup = node.xpath("groupeLaboratoire").text course.creditNbr = node.xpath("nombreCredits").text course.addPeriods(doc) courses.push(course) end return courses end |
Instance Method Details
#addPeriods(xml) ⇒ Object
31 32 33 |
# File 'lib/polyhoraire/course.rb', line 31 def addPeriods (xml) @periods = Poly::Period.from_nokogiri(xml,@acronym) end |
#description ⇒ Object
35 36 37 38 39 40 |
# File 'lib/polyhoraire/course.rb', line 35 def description name + '\n' + '\t\t - Professeur : ' + professor + '\n' + '\t\t - Groupe cours : ' + group + '\n' + '\t\t - Groupe lab : ' + labGroup end |