class Wonde::LessonRegister
Attributes
attendance[RW]
Public Class Methods
new()
click to toggle source
# File lib/writeback/lessonregister.rb, line 4 def initialize() self.attendance = Array.new() end
Public Instance Methods
add(lessonAttendance)
click to toggle source
# File lib/writeback/lessonregister.rb, line 12 def add(lessonAttendance) newlessonattendance = Array.new() newlessonattendance.push(lessonAttendance) newlessonattendance.each do |lessonAttendanceSingular| if lessonAttendanceSingular.class == LessonAttendanceRecord && lessonAttendanceSingular.isValid() self.attendance = lessonAttendanceSingular.toArray() else unless lessonAttendanceSingular.class == LessonAttendanceRecord throw InvalidLessonAttendanceException, 'Attendance is not an instance of the LessonAttendance Class.' end unless lessonAttendanceSingular.isValid() throw InvalidLessonAttendanceException, 'Attendance has empty fields.' end throw InvalidLessonAttendanceException end end end
to_json()
click to toggle source
# File lib/writeback/lessonregister.rb, line 8 def to_json() {'attendance' => [self.attendance]}.to_json end