class NetCity::Lesson
Attributes
end[R]
name[R]
number[R]
room[R]
start[R]
Public Class Methods
new(hash)
click to toggle source
# File lib/netcity/data.rb, line 65 def initialize(hash) @start = hash['startTime'] @end = hash['endTime'] @number = hash['number'] @name = hash['subjectName'] @room = hash['room'] return unless hash.include?('assignments') @assignments = hash['assignments'].map do |h| Assignment.new.tap do |a| a.id = h['id'] a.type = h['typeId'] a.name = h['assignmentName'] a.mark = h['mark']['mark'] if h.include?('mark') a.deadline = h['dueDate'] end end end
Public Instance Methods
[](index)
click to toggle source
# File lib/netcity/data.rb, line 84 def [](index) @assignments[index] end
each(&block)
click to toggle source
# File lib/netcity/data.rb, line 88 def each(&block) @assignments.each { |assignment| block.call(assignment) } end