class CourseType

Public Instance Methods

clean_str(str) click to toggle source
# File Entities/CourseType.rb, line 130
def clean_str(str)
  s = str.to_s.split("\n").
      collect { |s| s.sub(/^\s*/, '').sub(/\s*$/, '') }.
      select { |s| s.length > 0 }
  [s.join("\n"), s.length]
end
delete() click to toggle source
Calls superclass method
# File Entities/CourseType.rb, line 153
def delete
  if Courses.search_by_ctype(self).size > 0
    log_msg :CourseType, "Tried to delete #{self.name} while courses still depend on it"
    return false
  else
    super
    return true
  end
end
file_diploma=(f) click to toggle source
# File Entities/CourseType.rb, line 163
def file_diploma=(f)
  return if @loading
  self._file_diploma = f
  Courses.search_by_ctype(self).each{|c|
    c.update_exam_file
  }
  f
end
files_arr() click to toggle source
# File Entities/CourseType.rb, line 149
def files_arr
  files_str.to_s.split("\n")
end
files_str=(str) click to toggle source
# File Entities/CourseType.rb, line 145
def files_str=(str)
  self._files_str, self.files_nbr = clean_str(str)
end
get_unique() click to toggle source
# File Entities/CourseType.rb, line 126
def get_unique
  name
end
setup_instance() click to toggle source
# File Entities/CourseType.rb, line 121
def setup_instance
  self.diploma_lang ||= ['fr']
  self.files_nbr ||= 0
end
tests_arr() click to toggle source
# File Entities/CourseType.rb, line 141
def tests_arr
  tests_str.to_s.split("\n")
end
tests_str=(str) click to toggle source
# File Entities/CourseType.rb, line 137
def tests_str=(str)
  self._tests_str, self.tests_nbr = clean_str(str)
end