Class: Poly::Period

Inherits:
Object
  • Object
show all
Includes:
Poly
Defined in:
lib/polyhoraire/period.rb

Constant Summary

Constants included from Poly

URL, XSLDocs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Poly

#fetch, userConfDir, userConfDir=

Constructor Details

#initialize(from, to, week, weekDay, group, location, isLab) ⇒ Period

Returns a new instance of Period.



9
10
11
12
13
14
15
16
17
# File 'lib/polyhoraire/period.rb', line 9

def initialize(from,to,week,weekDay,group,location,isLab)
  @from = from
  @to = to
  @week = week
  @weekDay = weekDay
  @group = group
  @location = location
  @isLab = isLab
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def from
  @from
end

#groupObject (readonly)

Returns the value of attribute group.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def group
  @group
end

#isLabObject (readonly)

Returns the value of attribute isLab.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def isLab
  @isLab
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def location
  @location
end

#toObject (readonly)

Returns the value of attribute to.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def to
  @to
end

#weekObject (readonly)

Returns the value of attribute week.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def week
  @week
end

#weekDayObject (readonly)

Returns the value of attribute weekDay.



7
8
9
# File 'lib/polyhoraire/period.rb', line 7

def weekDay
  @weekDay
end

Class Method Details

.from_nokogiri(doc, acronym) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/polyhoraire/period.rb', line 19

def self.from_nokogiri(doc, acronym)
  nodeSet = doc.xpath("//evenement[sigle = '" + acronym + "']")
  if nodeSet.nil? || nodeSet.empty?
    raise ArgumentError
  else
    periods = Array.new
    nodeSet.each do |node|
      periods.push self.parse_node(node)
    end
  
    return periods
  end
end

Instance Method Details

#dates(trimester, week, day) ⇒ Object



33
34
35
# File 'lib/polyhoraire/period.rb', line 33

def dates(trimester,week,day)
  return @trimester.week[week][day]
end

#to_sObject



37
38
39
40
41
# File 'lib/polyhoraire/period.rb', line 37

def to_s
  puts "---"
  puts "From : " + @from + " To : " + @to + " On day : " + @weekDay
  puts "---"
end