studium 0.13.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of studium might be problematic. Click here for more details.

Files changed (871) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +2785 -0
  3. data/bin/ask_exam_question +7 -0
  4. data/bin/check_description_of_these_lectures +7 -0
  5. data/bin/curriculum_module_displayer +7 -0
  6. data/bin/cycle +7 -0
  7. data/bin/d10 +7 -0
  8. data/bin/d100 +7 -0
  9. data/bin/d15 +7 -0
  10. data/bin/d20 +7 -0
  11. data/bin/d25 +7 -0
  12. data/bin/d3 +7 -0
  13. data/bin/d30 +7 -0
  14. data/bin/d5 +7 -0
  15. data/bin/determine_curricula +7 -0
  16. data/bin/display_lecture_url +7 -0
  17. data/bin/exam_registration_at +7 -0
  18. data/bin/exam_statistics +7 -0
  19. data/bin/exams_per_month +9 -0
  20. data/bin/finished_exams_at_this_university +7 -0
  21. data/bin/flashcards +7 -0
  22. data/bin/from_curriculum_id_to_university +9 -0
  23. data/bin/location_to_this_exam_topic.rb +7 -0
  24. data/bin/mandatory_continuous_assessment +7 -0
  25. data/bin/mandatory_upcoming_courses +7 -0
  26. data/bin/n_ECTS +7 -0
  27. data/bin/n_exam_questions_already_answered +16 -0
  28. data/bin/nquestions +7 -0
  29. data/bin/nsolved +7 -0
  30. data/bin/open_last_exam_question_asked_file +7 -0
  31. data/bin/passed_exams +7 -0
  32. data/bin/passed_pr/303/274fungsimmanente_courses +7 -0
  33. data/bin/pdf_for +7 -0
  34. data/bin/random_exam_topic +7 -0
  35. data/bin/report_solved_topics +7 -0
  36. data/bin/return_n_ects_from_this_file +7 -0
  37. data/bin/search_for_n_ects +7 -0
  38. data/bin/show_lectures_on_the_commandline +7 -0
  39. data/bin/show_themes +7 -0
  40. data/bin/solved +9 -0
  41. data/bin/solved_ects +7 -0
  42. data/bin/studienkennzahl +7 -0
  43. data/bin/studium +7 -0
  44. data/bin/studium_skeleton +7 -0
  45. data/bin/ufind +7 -0
  46. data/bin/upcoming_exams +7 -0
  47. data/bin/week_parser +7 -0
  48. data/doc/ECTS_CONSIDERATIONS.md +81 -0
  49. data/doc/HOW_TO_DETERMINE_WHICH_PART_IS_THE_QUESTION_AND_WHICH_PART_IS_THE_ANSWER.md +44 -0
  50. data/doc/README.gen +2742 -0
  51. data/doc/SQL_database_specification.md +46 -0
  52. data/doc/deprecated_components.md +24 -0
  53. data/doc/documentation_for_the_file_lecture_information.md +311 -0
  54. data/doc/elegant_colours.md +21 -0
  55. data/doc/todo/TODO_FOR_STUDIUM_GEM.md +112 -0
  56. data/doc/todo/TODO_FOR_THE_GRAPHICAL_PARTS_OF_THE_STUDIUM_GEM_INCLUDING_WWW_RELATED_ASPECTS.md +35 -0
  57. data/img/STUDIES.png +0 -0
  58. data/lib/studium/autoinclude.rb +7 -0
  59. data/lib/studium/base/base.rb +2710 -0
  60. data/lib/studium/base/prototype.rb +543 -0
  61. data/lib/studium/c/README.md +2 -0
  62. data/lib/studium/c/a.out +0 -0
  63. data/lib/studium/c/obtain_random_entry.c +11 -0
  64. data/lib/studium/check_and_sanitize/README.md +11 -0
  65. data/lib/studium/check_and_sanitize/check_curriculum_for_correct_separation_of_bachelor_and_master.rb +141 -0
  66. data/lib/studium/check_and_sanitize/check_for_all_exam_topics_being_registered.rb +110 -0
  67. data/lib/studium/check_and_sanitize/check_for_correct_themes_of_each_course.rb +90 -0
  68. data/lib/studium/check_and_sanitize/check_for_existing_description_of_this_lecture.rb +189 -0
  69. data/lib/studium/check_and_sanitize/check_the_lecture_information_file.rb +163 -0
  70. data/lib/studium/check_and_sanitize/find_duplicate_lectures.rb +115 -0
  71. data/lib/studium/check_and_sanitize/missing_priority_entry.rb +44 -0
  72. data/lib/studium/check_and_sanitize/sanitize_this_string_containing_the_lva_dates.rb +79 -0
  73. data/lib/studium/colours/colours.rb +549 -0
  74. data/lib/studium/colours/sfancy.rb +46 -0
  75. data/lib/studium/colours/sfile.rb +35 -0
  76. data/lib/studium/colours/simp.rb +40 -0
  77. data/lib/studium/colours/use_colours.rb +39 -0
  78. data/lib/studium/colours/use_this_colour_for_exam_questions_and_exam_answers.rb +80 -0
  79. data/lib/studium/commandline/commandline.rb +932 -0
  80. data/lib/studium/commandline/menu.rb +903 -0
  81. data/lib/studium/constants/colours.rb +14 -0
  82. data/lib/studium/constants/constants.rb +2142 -0
  83. data/lib/studium/constants/image_constants.rb +217 -0
  84. data/lib/studium/constants/web_constants.rb +25 -0
  85. data/lib/studium/css/project.css +267 -0
  86. data/lib/studium/curricula/curriculum.rb +210 -0
  87. data/lib/studium/curricula/curriculum_as_string.rb +280 -0
  88. data/lib/studium/curricula/curriculum_module_displayer/constants.rb +33 -0
  89. data/lib/studium/curricula/curriculum_module_displayer/curriculum_module_displayer.rb +417 -0
  90. data/lib/studium/curricula/curriculum_module_displayer/initialize.rb +25 -0
  91. data/lib/studium/curricula/curriculum_module_displayer/menu.rb +45 -0
  92. data/lib/studium/curricula/curriculum_module_displayer/reset.rb +74 -0
  93. data/lib/studium/curricula/curriculum_module_displayer/run.rb +20 -0
  94. data/lib/studium/curricula/curriculum_module_displayer/set_use_this_curriculum.rb +93 -0
  95. data/lib/studium/curricula/curriculum_module_displayer/show_and_report.rb +190 -0
  96. data/lib/studium/curricula/determine_curricula/constants.rb +11 -0
  97. data/lib/studium/curricula/determine_curricula/determine_curricula.rb +36 -0
  98. data/lib/studium/curricula/determine_curricula/help.rb +39 -0
  99. data/lib/studium/curricula/determine_curricula/initialize.rb +48 -0
  100. data/lib/studium/curricula/determine_curricula/menu.rb +151 -0
  101. data/lib/studium/curricula/determine_curricula/misc.rb +403 -0
  102. data/lib/studium/curricula/determine_curricula/report.rb +143 -0
  103. data/lib/studium/curricula/determine_curricula/reset.rb +59 -0
  104. data/lib/studium/curricula/determine_curricula/run.rb +19 -0
  105. data/lib/studium/curricula/determine_elective_courses_in_this_curriculum.rb +112 -0
  106. data/lib/studium/curricula/display_bachelor_curricula.rb +90 -0
  107. data/lib/studium/curricula/mitteilungsbl/303/244tter/mitteilungsbl/303/244tter.rb +324 -0
  108. data/lib/studium/curricula/modules/display_on_the_commandline.rb +319 -0
  109. data/lib/studium/curricula/modules/return_n_ects_in_this_module.rb +75 -0
  110. data/lib/studium/curricula/n_percent_solved_in_this_curriculum.rb +75 -0
  111. data/lib/studium/curricula/prepare_individual_curriculum.rb +304 -0
  112. data/lib/studium/curricula/random_curriculum_creator/random_curriculum_creator.rb +163 -0
  113. data/lib/studium/curricula/show_lectures_of_this_curriculum.rb +114 -0
  114. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/constants.rb +11 -0
  115. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/initialize.rb +27 -0
  116. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/menu.rb +35 -0
  117. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/misc.rb +264 -0
  118. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/report.rb +163 -0
  119. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/reset.rb +64 -0
  120. data/lib/studium/curricula/show_lectures_of_this_curriculum_id/show_lectures_of_this_curriculum_id.rb +38 -0
  121. data/lib/studium/curricula/show_solved_percentage_among_the_registered_curricula.rb +87 -0
  122. data/lib/studium/ects/boku_ects_splitter.rb +128 -0
  123. data/lib/studium/ects/ects_per_university.rb +179 -0
  124. data/lib/studium/ects/ects_scanner.rb +141 -0
  125. data/lib/studium/ects/ects_to_university_parser.rb +142 -0
  126. data/lib/studium/ects/last_entry_is_curriculum.rb +150 -0
  127. data/lib/studium/ects/n_ects_in_these_lectures.rb +196 -0
  128. data/lib/studium/ects/n_ects_points_in_mandatory_presence_courses.rb +50 -0
  129. data/lib/studium/ects/return_n_ects_from_this_file.rb +59 -0
  130. data/lib/studium/ects/return_n_ects_from_this_url.rb +196 -0
  131. data/lib/studium/ects/search_for_n_ects.rb +614 -0
  132. data/lib/studium/ects/show_completed_ects_in_all_curricula.rb +191 -0
  133. data/lib/studium/ects/show_passed_credits_per_curriculum.rb +276 -0
  134. data/lib/studium/ects/simple_total_ects_points.rb +135 -0
  135. data/lib/studium/ects/solved_ects/constants.rb +19 -0
  136. data/lib/studium/ects/solved_ects/reset.rb +51 -0
  137. data/lib/studium/ects/solved_ects/solved_ects.rb +325 -0
  138. data/lib/studium/ects/solved_ects_per_university/reset.rb +25 -0
  139. data/lib/studium/ects/solved_ects_per_university/solved_ects_per_university.rb +106 -0
  140. data/lib/studium/ects/still_missing.rb +129 -0
  141. data/lib/studium/ects/sum_of_ects.rb +144 -0
  142. data/lib/studium/encoding/encoding.rb +108 -0
  143. data/lib/studium/exam_topics/RNAi_siRNA_and_miRNA +86 -0
  144. data/lib/studium/exam_topics/abfall_als_ressource +86 -0
  145. data/lib/studium/exam_topics/advanced_biochemistry +781 -0
  146. data/lib/studium/exam_topics/advanced_biotechnology +214 -0
  147. data/lib/studium/exam_topics/advanced_cellbiology +27 -0
  148. data/lib/studium/exam_topics/advanced_chemistry +504 -0
  149. data/lib/studium/exam_topics/advanced_microbiology +43 -0
  150. data/lib/studium/exam_topics/advanced_topics_in_plant_sciences +85 -0
  151. data/lib/studium/exam_topics/advanced_virology +218 -0
  152. data/lib/studium/exam_topics/ageing +114 -0
  153. data/lib/studium/exam_topics/agrar_ecology +63 -0
  154. data/lib/studium/exam_topics/agrarmarkt +71 -0
  155. data/lib/studium/exam_topics/agrarphysik +35 -0
  156. data/lib/studium/exam_topics/alcohols +29 -0
  157. data/lib/studium/exam_topics/algorithms +52 -0
  158. data/lib/studium/exam_topics/allergie +75 -0
  159. data/lib/studium/exam_topics/allgemeine_genetik +1006 -0
  160. data/lib/studium/exam_topics/allgemeine_mikrobiologie +946 -0
  161. data/lib/studium/exam_topics/aminoacids +438 -0
  162. data/lib/studium/exam_topics/analytische_chemie_1 +132 -0
  163. data/lib/studium/exam_topics/analytische_chemie_2 +31 -0
  164. data/lib/studium/exam_topics/anatomie +290 -0
  165. data/lib/studium/exam_topics/anorganische_chemie +311 -0
  166. data/lib/studium/exam_topics/anthropologie +116 -0
  167. data/lib/studium/exam_topics/antibodies_and_antigens +764 -0
  168. data/lib/studium/exam_topics/apoptosis +35 -0
  169. data/lib/studium/exam_topics/archaea +60 -0
  170. data/lib/studium/exam_topics/architecture +8 -0
  171. data/lib/studium/exam_topics/artificial_intelligence +81 -0
  172. data/lib/studium/exam_topics/atomemissionsspektrometrie +6 -0
  173. data/lib/studium/exam_topics/audio +11 -0
  174. data/lib/studium/exam_topics/bacteriophages +240 -0
  175. data/lib/studium/exam_topics/basic_biochemistry +1002 -0
  176. data/lib/studium/exam_topics/basic_biotechnology +1001 -0
  177. data/lib/studium/exam_topics/basic_chemistry +1007 -0
  178. data/lib/studium/exam_topics/basic_virology +1008 -0
  179. data/lib/studium/exam_topics/bauwesen +6 -0
  180. data/lib/studium/exam_topics/betriebssysteme +126 -0
  181. data/lib/studium/exam_topics/betriebswirtschaftslehre +29 -0
  182. data/lib/studium/exam_topics/bioanalytik_und_biosensoren +382 -0
  183. data/lib/studium/exam_topics/biochips +78 -0
  184. data/lib/studium/exam_topics/bioelektrochemie +57 -0
  185. data/lib/studium/exam_topics/biofilms +22 -0
  186. data/lib/studium/exam_topics/bioinformatics +503 -0
  187. data/lib/studium/exam_topics/biological_therapeutics +153 -0
  188. data/lib/studium/exam_topics/biologie +137 -0
  189. data/lib/studium/exam_topics/biomarkers +106 -0
  190. data/lib/studium/exam_topics/biomaterials +89 -0
  191. data/lib/studium/exam_topics/biomembranes +6 -0
  192. data/lib/studium/exam_topics/bionik +65 -0
  193. data/lib/studium/exam_topics/biophysik +34 -0
  194. data/lib/studium/exam_topics/biopolymers +10 -0
  195. data/lib/studium/exam_topics/bioprozesstechnik +149 -0
  196. data/lib/studium/exam_topics/bioressourcenmanagement +78 -0
  197. data/lib/studium/exam_topics/bodenkunde +373 -0
  198. data/lib/studium/exam_topics/bodenmikrobiologie +40 -0
  199. data/lib/studium/exam_topics/cancerbiology +442 -0
  200. data/lib/studium/exam_topics/cell_cultures +155 -0
  201. data/lib/studium/exam_topics/cellbiology +995 -0
  202. data/lib/studium/exam_topics/cellular_transport_and_protein_secretion +27 -0
  203. data/lib/studium/exam_topics/cellulose +6 -0
  204. data/lib/studium/exam_topics/chemische_technologie_anorganischer_stoffe +209 -0
  205. data/lib/studium/exam_topics/chemische_technologie_organischer_stoffe +25 -0
  206. data/lib/studium/exam_topics/chemisches_labor +60 -0
  207. data/lib/studium/exam_topics/chemotaxis_and_motility_in_prokaryotes +87 -0
  208. data/lib/studium/exam_topics/citric_acid_cycle +80 -0
  209. data/lib/studium/exam_topics/clinical_microbiology +492 -0
  210. data/lib/studium/exam_topics/computer_graphics +5 -0
  211. data/lib/studium/exam_topics/computer_science +280 -0
  212. data/lib/studium/exam_topics/crispr +28 -0
  213. data/lib/studium/exam_topics/cyanobacteria +42 -0
  214. data/lib/studium/exam_topics/cytogenetics_and_chromosome_biology +551 -0
  215. data/lib/studium/exam_topics/cytokines +5 -0
  216. data/lib/studium/exam_topics/databases_and_sql +106 -0
  217. data/lib/studium/exam_topics/dna_mutation_and_dna_repair +35 -0
  218. data/lib/studium/exam_topics/dna_replication +56 -0
  219. data/lib/studium/exam_topics/ecogenetics +26 -0
  220. data/lib/studium/exam_topics/ecological_agriculture +12 -0
  221. data/lib/studium/exam_topics/ecology +314 -0
  222. data/lib/studium/exam_topics/economy +211 -0
  223. data/lib/studium/exam_topics/elektronenmikroskopie +354 -0
  224. data/lib/studium/exam_topics/elektrophorese +89 -0
  225. data/lib/studium/exam_topics/elektrotechnik_und_elektrizit/303/244t +41 -0
  226. data/lib/studium/exam_topics/elisa +54 -0
  227. data/lib/studium/exam_topics/embryologie_und_entwicklung +547 -0
  228. data/lib/studium/exam_topics/endospores_and_spores +104 -0
  229. data/lib/studium/exam_topics/enzymes_and_cofactors +345 -0
  230. data/lib/studium/exam_topics/epigenetik +179 -0
  231. data/lib/studium/exam_topics/ethik +138 -0
  232. data/lib/studium/exam_topics/evolution_and_evolutionary_genetics +328 -0
  233. data/lib/studium/exam_topics/excel +7 -0
  234. data/lib/studium/exam_topics/fish +19 -0
  235. data/lib/studium/exam_topics/fluorescence_microscopy +7 -0
  236. data/lib/studium/exam_topics/food_microbiology_and_food_biotechnology +71 -0
  237. data/lib/studium/exam_topics/forensik +11 -0
  238. data/lib/studium/exam_topics/forstwirtschaft +53 -0
  239. data/lib/studium/exam_topics/fortgeschrittene_genetik +511 -0
  240. data/lib/studium/exam_topics/fortgeschrittene_gentechnik +211 -0
  241. data/lib/studium/exam_topics/fortgeschrittene_physik +6 -0
  242. data/lib/studium/exam_topics/fungi +79 -0
  243. data/lib/studium/exam_topics/genetische_krankheiten +176 -0
  244. data/lib/studium/exam_topics/genexpression +1008 -0
  245. data/lib/studium/exam_topics/genomics_and_metagenomics +244 -0
  246. data/lib/studium/exam_topics/gentechnik_und_praktische_biochemie +901 -0
  247. data/lib/studium/exam_topics/geochemistry +67 -0
  248. data/lib/studium/exam_topics/geography +8 -0
  249. data/lib/studium/exam_topics/geologie_und_mineralogie +621 -0
  250. data/lib/studium/exam_topics/geometrie +47 -0
  251. data/lib/studium/exam_topics/geschichte +93 -0
  252. data/lib/studium/exam_topics/gluconeogenesis +59 -0
  253. data/lib/studium/exam_topics/glycogen +25 -0
  254. data/lib/studium/exam_topics/glycolysis +109 -0
  255. data/lib/studium/exam_topics/glykomik +100 -0
  256. data/lib/studium/exam_topics/glyoxylatzyklus +31 -0
  257. data/lib/studium/exam_topics/grassland_cultivation +32 -0
  258. data/lib/studium/exam_topics/hormone +134 -0
  259. data/lib/studium/exam_topics/html +7 -0
  260. data/lib/studium/exam_topics/human_ecology +8 -0
  261. data/lib/studium/exam_topics/hygiene +191 -0
  262. data/lib/studium/exam_topics/imaging_and_microscopy +241 -0
  263. data/lib/studium/exam_topics/immunanalytik +94 -0
  264. data/lib/studium/exam_topics/immunologie +982 -0
  265. data/lib/studium/exam_topics/informatik +97 -0
  266. data/lib/studium/exam_topics/innate_immunity +22 -0
  267. data/lib/studium/exam_topics/insekten +57 -0
  268. data/lib/studium/exam_topics/insulin_and_diabetes +57 -0
  269. data/lib/studium/exam_topics/java +502 -0
  270. data/lib/studium/exam_topics/javascript +12 -0
  271. data/lib/studium/exam_topics/klima +6 -0
  272. data/lib/studium/exam_topics/kryptographie +5 -0
  273. data/lib/studium/exam_topics/landtechnik +26 -0
  274. data/lib/studium/exam_topics/lebensmittel +208 -0
  275. data/lib/studium/exam_topics/lebensmitteltechnologie +16 -0
  276. data/lib/studium/exam_topics/linux +5 -0
  277. data/lib/studium/exam_topics/lipids +94 -0
  278. data/lib/studium/exam_topics/macroeconomics +40 -0
  279. data/lib/studium/exam_topics/mathematics +254 -0
  280. data/lib/studium/exam_topics/medizin_und_biomedizinische_technik +250 -0
  281. data/lib/studium/exam_topics/medizinische_chemie_und_pharmazie +398 -0
  282. data/lib/studium/exam_topics/messtechnik_und_regeltechnik +104 -0
  283. data/lib/studium/exam_topics/metabolismus +406 -0
  284. data/lib/studium/exam_topics/microbial_ecology +35 -0
  285. data/lib/studium/exam_topics/microcontrollers +11 -0
  286. data/lib/studium/exam_topics/mikrobielle_lebensgemeinschaften +33 -0
  287. data/lib/studium/exam_topics/mikrobielle_physiologie +172 -0
  288. data/lib/studium/exam_topics/mitochondria +32 -0
  289. data/lib/studium/exam_topics/mixed +278 -0
  290. data/lib/studium/exam_topics/molecular_biology_of_plants +242 -0
  291. data/lib/studium/exam_topics/molekulare_medizin +131 -0
  292. data/lib/studium/exam_topics/nanotechnologie +453 -0
  293. data/lib/studium/exam_topics/nature_conservation_and_biodiversity +166 -0
  294. data/lib/studium/exam_topics/naturstoffe +9 -0
  295. data/lib/studium/exam_topics/netzwerke +32 -0
  296. data/lib/studium/exam_topics/neurobiology +267 -0
  297. data/lib/studium/exam_topics/nucleotide_sequencing +32 -0
  298. data/lib/studium/exam_topics/nutztierethologie +11 -0
  299. data/lib/studium/exam_topics/object_oriented_modeling +14 -0
  300. data/lib/studium/exam_topics/obstbau +234 -0
  301. data/lib/studium/exam_topics/organische_chemie +1007 -0
  302. data/lib/studium/exam_topics/organische_chemie_2 +118 -0
  303. data/lib/studium/exam_topics/paleobiology +35 -0
  304. data/lib/studium/exam_topics/parasitic_diseases_and_molecular_infection_biology +335 -0
  305. data/lib/studium/exam_topics/patent_law +55 -0
  306. data/lib/studium/exam_topics/pathologie +717 -0
  307. data/lib/studium/exam_topics/pcr +144 -0
  308. data/lib/studium/exam_topics/pentosephosphatweg +41 -0
  309. data/lib/studium/exam_topics/peroxisomes_glycosomes_and_lysosomes +54 -0
  310. data/lib/studium/exam_topics/pflanzenanatomie +255 -0
  311. data/lib/studium/exam_topics/pflanzenbau +24 -0
  312. data/lib/studium/exam_topics/pflanzenschutz +35 -0
  313. data/lib/studium/exam_topics/pflanzenwissenschaften +1009 -0
  314. data/lib/studium/exam_topics/pharmaceutical_biotechnology +250 -0
  315. data/lib/studium/exam_topics/physik +433 -1
  316. data/lib/studium/exam_topics/physikalische_chemie +86 -0
  317. data/lib/studium/exam_topics/physiology_and_histology +506 -0
  318. data/lib/studium/exam_topics/phytochemie +33 -0
  319. data/lib/studium/exam_topics/plant_biotechnology +128 -0
  320. data/lib/studium/exam_topics/plant_breeding +64 -0
  321. data/lib/studium/exam_topics/plant_development +50 -0
  322. data/lib/studium/exam_topics/populationsgenetik +136 -0
  323. data/lib/studium/exam_topics/posttranslationale_modifikation_von_proteinen +191 -0
  324. data/lib/studium/exam_topics/projektmanagement +219 -0
  325. data/lib/studium/exam_topics/prokaryote_genetics +531 -0
  326. data/lib/studium/exam_topics/protein_engineering +8 -0
  327. data/lib/studium/exam_topics/proteolyse +33 -0
  328. data/lib/studium/exam_topics/proteomik +40 -0
  329. data/lib/studium/exam_topics/prozesstechnik +95 -0
  330. data/lib/studium/exam_topics/psychologie +13 -0
  331. data/lib/studium/exam_topics/python +353 -0
  332. data/lib/studium/exam_topics/quality_management +256 -0
  333. data/lib/studium/exam_topics/rechtsgrundlagen +115 -0
  334. data/lib/studium/exam_topics/research_topics_in_immunobiology +42 -0
  335. data/lib/studium/exam_topics/rna_and_dna +395 -0
  336. data/lib/studium/exam_topics/rna_seq +11 -0
  337. data/lib/studium/exam_topics/ruby +146 -0
  338. data/lib/studium/exam_topics/ruby_on_rails +63 -0
  339. data/lib/studium/exam_topics/scientific_writing_and_publishing +38 -0
  340. data/lib/studium/exam_topics/semisynthese_von_proteinen_und_nukleotiden +120 -0
  341. data/lib/studium/exam_topics/sexualbiologie +62 -0
  342. data/lib/studium/exam_topics/signal_transduction_and_laser_systems +167 -0
  343. data/lib/studium/exam_topics/splicing_exons_and_introns +63 -0
  344. data/lib/studium/exam_topics/statistik +233 -0
  345. data/lib/studium/exam_topics/stemcells +158 -0
  346. data/lib/studium/exam_topics/stickstofffixierung +75 -0
  347. data/lib/studium/exam_topics/structural_bioinformatics +54 -0
  348. data/lib/studium/exam_topics/strukturbiologie +380 -0
  349. data/lib/studium/exam_topics/system_biology_and_synthetic_biology +101 -0
  350. data/lib/studium/exam_topics/systematische_zoologie +433 -0
  351. data/lib/studium/exam_topics/technical_ecology +144 -0
  352. data/lib/studium/exam_topics/technische_chemie +202 -0
  353. data/lib/studium/exam_topics/technische_grundlagen_der_informatik +26 -0
  354. data/lib/studium/exam_topics/technische_mikrobiologie +393 -0
  355. data/lib/studium/exam_topics/technisches_zeichnen +5 -0
  356. data/lib/studium/exam_topics/the_bacterial_cell_wall +97 -0
  357. data/lib/studium/exam_topics/the_c_plus_plus_programming_language +489 -0
  358. data/lib/studium/exam_topics/the_c_programming_language +129 -0
  359. data/lib/studium/exam_topics/the_cellcycle +81 -0
  360. data/lib/studium/exam_topics/the_european_union +119 -0
  361. data/lib/studium/exam_topics/the_interferon_system +38 -0
  362. data/lib/studium/exam_topics/the_microbiome +163 -0
  363. data/lib/studium/exam_topics/the_universe +12 -0
  364. data/lib/studium/exam_topics/theoretische_chemie +5 -0
  365. data/lib/studium/exam_topics/theoretische_informatik +157 -0
  366. data/lib/studium/exam_topics/tierzucht +94 -0
  367. data/lib/studium/exam_topics/toxikologie +408 -0
  368. data/lib/studium/exam_topics/transcription +82 -0
  369. data/lib/studium/exam_topics/translation_ribosomes_and_translational_control +142 -0
  370. data/lib/studium/exam_topics/umweltbiotechnologie +63 -0
  371. data/lib/studium/exam_topics/umweltchemie +233 -0
  372. data/lib/studium/exam_topics/urbanism_and_traffic +19 -0
  373. data/lib/studium/exam_topics/urea_cycle +55 -0
  374. data/lib/studium/exam_topics/vaccines_and_vaccination +242 -0
  375. data/lib/studium/exam_topics/vectors_and_gene_therapy +240 -0
  376. data/lib/studium/exam_topics/verfahrenstechnik +32 -0
  377. data/lib/studium/exam_topics/veterinary_medicine +10 -0
  378. data/lib/studium/exam_topics/vitamine +24 -0
  379. data/lib/studium/exam_topics/wasserkunde +137 -0
  380. data/lib/studium/exam_topics/weinbau +59 -0
  381. data/lib/studium/exam_topics/wissenschaft +18 -0
  382. data/lib/studium/exam_topics/yeast +102 -0
  383. data/lib/studium/exam_topics/zoologie +330 -0
  384. data/lib/studium/exams/afterburn/afterburn.rb +257 -0
  385. data/lib/studium/exams/ask_exam_from_the_upcoming_exams_pool.rb +150 -0
  386. data/lib/studium/exams/ask_exam_topic_question.rb +112 -0
  387. data/lib/studium/exams/ask_question_from_alias.rb +141 -0
  388. data/lib/studium/exams/ask_question_from_any_of_the_still_missing_lectures.rb +131 -0
  389. data/lib/studium/exams/ask_question_from_grouped_themes.rb +141 -0
  390. data/lib/studium/exams/ask_question_from_last_topic.rb +91 -0
  391. data/lib/studium/exams/ask_random_question.rb +195 -0
  392. data/lib/studium/exams/autoinclude.rb +7 -0
  393. data/lib/studium/exams/csv/create_csv_passed_exams_file.rb +217 -0
  394. data/lib/studium/exams/cycle.rb +291 -0
  395. data/lib/studium/exams/dataset.rb +123 -0
  396. data/lib/studium/exams/designate_ten_random_exam_topics/designate_ten_random_exam_topics.rb +88 -0
  397. data/lib/studium/exams/exam/exam.rb +130 -0
  398. data/lib/studium/exams/exam_question/README.md +3 -0
  399. data/lib/studium/exams/exam_question/answer.rb +177 -0
  400. data/lib/studium/exams/exam_question/constants.rb +111 -0
  401. data/lib/studium/exams/exam_question/exam_question.rb +1135 -0
  402. data/lib/studium/exams/exam_question/menu.rb +333 -0
  403. data/lib/studium/exams/exam_question/misc.rb +895 -0
  404. data/lib/studium/exams/exam_question/question.rb +91 -0
  405. data/lib/studium/exams/exam_question/reset.rb +96 -0
  406. data/lib/studium/exams/exam_registration_at/constants.rb +49 -0
  407. data/lib/studium/exams/exam_registration_at/exam_registration_at.rb +242 -0
  408. data/lib/studium/exams/exam_registration_at/help.rb +46 -0
  409. data/lib/studium/exams/exam_registration_at/menu.rb +81 -0
  410. data/lib/studium/exams/exam_registration_at/report_and_show.rb +133 -0
  411. data/lib/studium/exams/exam_registration_at/reset.rb +54 -0
  412. data/lib/studium/exams/exam_statistics_from_this_file/exam_statistics_from_this_file.rb +119 -0
  413. data/lib/studium/exams/exam_topics.rb +194 -0
  414. data/lib/studium/exams/exams.rb +20 -0
  415. data/lib/studium/exams/exams_per_month/exams_per_month.rb +2438 -0
  416. data/lib/studium/exams/exams_this_week.rb +182 -0
  417. data/lib/studium/exams/fix_exam_dates.rb +121 -0
  418. data/lib/studium/exams/frozen.rb +36 -0
  419. data/lib/studium/exams/last_exams/last_exams.rb +398 -0
  420. data/lib/studium/exams/lectures_without_exam_entry.rb +137 -0
  421. data/lib/studium/exams/mandatory_continuous_assessment/mandatory_continuous_assessment.rb +1956 -0
  422. data/lib/studium/exams/move_the_last_exam_question_to_the_top_of_the_file/move_the_last_exam_question_to_the_top_of_the_file.rb +111 -0
  423. data/lib/studium/exams/n_exams_in_these_topics.rb +404 -0
  424. data/lib/studium/exams/next_exam.rb +107 -0
  425. data/lib/studium/exams/next_exams.rb +378 -0
  426. data/lib/studium/exams/open_exam_associated_url.rb +154 -0
  427. data/lib/studium/exams/open_last_exam_question_asked_file/constants.rb +15 -0
  428. data/lib/studium/exams/open_last_exam_question_asked_file/initialize.rb +29 -0
  429. data/lib/studium/exams/open_last_exam_question_asked_file/open_last_exam_question_asked_file.rb +109 -0
  430. data/lib/studium/exams/pr/303/274fung.rb +289 -0
  431. data/lib/studium/exams/push_solved_questions_on_top.rb +180 -0
  432. data/lib/studium/exams/questions_solved_from_day_to_day/questions_solved_from_day_to_day.rb +377 -0
  433. data/lib/studium/exams/remote_ftp_url.rb +52 -0
  434. data/lib/studium/exams/repeat_last_question.rb +78 -0
  435. data/lib/studium/exams/show_all_passed_exams_of_this_university.rb +252 -0
  436. data/lib/studium/exams/show_backlog_of_exams.rb +117 -0
  437. data/lib/studium/exams/show_next_exams_for.rb +133 -0
  438. data/lib/studium/exams/show_themes/constants.rb +28 -0
  439. data/lib/studium/exams/show_themes/menu.rb +61 -0
  440. data/lib/studium/exams/show_themes/misc.rb +537 -0
  441. data/lib/studium/exams/show_themes/reset.rb +62 -0
  442. data/lib/studium/exams/show_themes/show_themes.rb +27 -0
  443. data/lib/studium/exams/show_upcoming_exams/consider_autogenerating_exam_aliases.rb +181 -0
  444. data/lib/studium/exams/show_upcoming_exams/constants.rb +82 -0
  445. data/lib/studium/exams/show_upcoming_exams/help.rb +33 -0
  446. data/lib/studium/exams/show_upcoming_exams/initialize.rb +77 -0
  447. data/lib/studium/exams/show_upcoming_exams/menu.rb +60 -0
  448. data/lib/studium/exams/show_upcoming_exams/report.rb +200 -0
  449. data/lib/studium/exams/show_upcoming_exams/reset.rb +45 -0
  450. data/lib/studium/exams/show_upcoming_exams/run.rb +20 -0
  451. data/lib/studium/exams/show_upcoming_exams/show_upcoming_exams.rb +544 -0
  452. data/lib/studium/exams/solve_all_questions_from_this_topic.rb +114 -0
  453. data/lib/studium/exams/solved/constants.rb +32 -0
  454. data/lib/studium/exams/solved/help.rb +24 -0
  455. data/lib/studium/exams/solved/initialize.rb +55 -0
  456. data/lib/studium/exams/solved/menu.rb +41 -0
  457. data/lib/studium/exams/solved/reset.rb +28 -0
  458. data/lib/studium/exams/solved/solved.rb +313 -0
  459. data/lib/studium/exams/unsolve_all_questions_from_this_topic.rb +162 -0
  460. data/lib/studium/exams/upcoming_exams/constants.rb +15 -0
  461. data/lib/studium/exams/upcoming_exams/help.rb +41 -0
  462. data/lib/studium/exams/upcoming_exams/initialize.rb +27 -0
  463. data/lib/studium/exams/upcoming_exams/menu.rb +79 -0
  464. data/lib/studium/exams/upcoming_exams/misc.rb +415 -0
  465. data/lib/studium/exams/upcoming_exams/reset.rb +34 -0
  466. data/lib/studium/exams/upcoming_exams/run.rb +26 -0
  467. data/lib/studium/exams/upcoming_exams/upcoming_exams.rb +32 -0
  468. data/lib/studium/exams/upcoming_exams_at_the_boku/constants.rb +23 -0
  469. data/lib/studium/exams/upcoming_exams_at_the_boku/html.rb +64 -0
  470. data/lib/studium/exams/upcoming_exams_at_the_boku/upcoming_exams_at_the_boku.rb +194 -0
  471. data/lib/studium/exams/upcoming_exams_dataset.rb +247 -0
  472. data/lib/studium/exams/upload_exam_topics.rb +360 -0
  473. data/lib/studium/graphviz/README.md +4 -0
  474. data/lib/studium/graphviz/bachelor_vector_based_strategies.dot +160 -0
  475. data/lib/studium/graphviz/master_vector_based_strategies.dot +46 -0
  476. data/lib/studium/gui/gtk3/README.md +1 -0
  477. data/lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.config +6 -0
  478. data/lib/studium/gui/gtk3/ask_exam_question/ask_exam_question.rb +760 -0
  479. data/lib/studium/gui/gtk3/ask_exam_question/manifest.yml +12 -0
  480. data/lib/studium/gui/gtk3/control_panel/control_panel.rb +39 -0
  481. data/lib/studium/gui/gtk3/curriculum_viewer/curriculum_viewer.rb +510 -0
  482. data/lib/studium/gui/gtk3/ects_per_university/ects_per_university.rb +217 -0
  483. data/lib/studium/gui/gtk3/exam_question_widget/exam_question_widget.rb +1887 -0
  484. data/lib/studium/gui/gtk3/expand_time_range/expand_time_range.rb +34 -0
  485. data/lib/studium/gui/gtk3/information_about_a_lecture/information_about_a_lecture.rb +34 -0
  486. data/lib/studium/gui/gtk3/lecture_information/lecture_information.rb +200 -0
  487. data/lib/studium/gui/gtk3/show_upcoming_exams/show_upcoming_exams.rb +34 -0
  488. data/lib/studium/gui/java/exam_question/ExamQuestion$1.class +0 -0
  489. data/lib/studium/gui/java/exam_question/ExamQuestion.class +0 -0
  490. data/lib/studium/gui/java/exam_question/ExamQuestion.java +215 -0
  491. data/lib/studium/gui/javafx/exam_question_widget/exam_question_widget.rb +58 -0
  492. data/lib/studium/gui/jruby/exam_question_widget/exam_question_widget.rb +317 -0
  493. data/lib/studium/gui/libui/ask_exam_question/ask_exam_question.rb +349 -0
  494. data/lib/studium/gui/shared_code/control_panel/control_panel_module.rb +314 -0
  495. data/lib/studium/gui/shared_code/exam_question_widget/exam_question_widget_module.rb +39 -0
  496. data/lib/studium/gui/shared_code/expand_time_range/expand_time_range.css +0 -0
  497. data/lib/studium/gui/shared_code/expand_time_range/expand_time_range_module.rb +190 -0
  498. data/lib/studium/gui/shared_code/information_about_a_lecture/information_about_a_lecture_module.rb +180 -0
  499. data/lib/studium/gui/shared_code/show_upcoming_exams/show_upcoming_exams_module.rb +206 -0
  500. data/lib/studium/images/libui_ask_exam_question.png +0 -0
  501. data/lib/studium/images/small_logos/DNA.png +0 -0
  502. data/lib/studium/images/small_logos/README.md +2 -0
  503. data/lib/studium/images/studies_favicon.png +0 -0
  504. data/lib/studium/java/Mkdir.java +15 -0
  505. data/lib/studium/java/README.md +2 -0
  506. data/lib/studium/java/ask_exam_question/AskExamQuestion.java +477 -0
  507. data/lib/studium/java/solved/Solved.class +0 -0
  508. data/lib/studium/java/solved/Solved.java +110 -0
  509. data/lib/studium/java/utility_scripts/OpenLastExamQuestionurlLinkViaTheBrowser.class +0 -0
  510. data/lib/studium/java/utility_scripts/OpenLastExamQuestionurlLinkViaTheBrowser.java +80 -0
  511. data/lib/studium/logging/README.md +2 -0
  512. data/lib/studium/logging/ensure_that_the_log_directory_exists.rb +47 -0
  513. data/lib/studium/logging/html_log_directory.rb +41 -0
  514. data/lib/studium/logging/log_directory.rb +112 -0
  515. data/lib/studium/logging/store_last_question_asked_into_file.rb +137 -0
  516. data/lib/studium/parsers/README.md +2 -0
  517. data/lib/studium/parsers/custom_exam_results_parser.rb +206 -0
  518. data/lib/studium/parsers/parse_lva_dates.rb +190 -0
  519. data/lib/studium/parsers/parse_remote_lecture.rb +325 -0
  520. data/lib/studium/project/project.rb +76 -0
  521. data/lib/studium/requires/common_popular_requires.rb +37 -0
  522. data/lib/studium/requires/commonly_used_requires.rb +14 -0
  523. data/lib/studium/requires/require_class_exams_solved.rb +7 -0
  524. data/lib/studium/requires/require_ects_scripts.rb +27 -0
  525. data/lib/studium/requires/require_encoding.rb +7 -0
  526. data/lib/studium/requires/require_the_check_and_sanitize_files.rb +31 -0
  527. data/lib/studium/requires/require_the_curricula_files.rb +28 -0
  528. data/lib/studium/requires/require_the_exam_question_class.rb +7 -0
  529. data/lib/studium/requires/require_the_exams_files.rb +45 -0
  530. data/lib/studium/requires/require_the_logging_files.rb +23 -0
  531. data/lib/studium/requires/require_the_parsers.rb +28 -0
  532. data/lib/studium/requires/require_the_studium_constants.rb +10 -0
  533. data/lib/studium/requires/require_the_studium_project.rb +54 -0
  534. data/lib/studium/requires/require_the_toplevel_methods.rb +27 -0
  535. data/lib/studium/requires/require_the_utility_scripts.rb +49 -0
  536. data/lib/studium/requires/require_upcoming_exams.rb +7 -0
  537. data/lib/studium/requires/require_yaml.rb +7 -0
  538. data/lib/studium/requires/return_remote_homepage_of_this_lecture.rb +7 -0
  539. data/lib/studium/requires/with_GUI.rb +13 -0
  540. data/lib/studium/requires/www_mode.rb +17 -0
  541. data/lib/studium/statistics/README.md +4 -0
  542. data/lib/studium/statistics/best_exam_months.rb +92 -0
  543. data/lib/studium/statistics/curriculum_comparer.rb +336 -0
  544. data/lib/studium/statistics/determine_exam_statistics_from_this_file.rb +142 -0
  545. data/lib/studium/statistics/exam_topics_that_are_about_to_be_completed.rb +119 -0
  546. data/lib/studium/statistics/max_stats.rb +170 -0
  547. data/lib/studium/statistics/new_questions_per_year.rb +147 -0
  548. data/lib/studium/statistics/report_how_many_ects_points_per_curriculum_were_completed.rb +167 -0
  549. data/lib/studium/statistics/report_how_many_exam_questions_were_answered.rb +473 -0
  550. data/lib/studium/statistics/show_exam_statistics.rb +60 -0
  551. data/lib/studium/statistics/show_which_courses_are_in_a_bachelor_or_master_curriculum_respectively.rb +104 -0
  552. data/lib/studium/statistics/top_stats.rb +127 -0
  553. data/lib/studium/toplevel_methods/all_passed_exams.rb +37 -0
  554. data/lib/studium/toplevel_methods/already_solved_this_lecture.rb +100 -0
  555. data/lib/studium/toplevel_methods/available_topics.rb +156 -0
  556. data/lib/studium/toplevel_methods/average_grade.rb +141 -0
  557. data/lib/studium/toplevel_methods/calculate_pr/303/274fungsimmanente_lectures_from_this_file.rb +55 -0
  558. data/lib/studium/toplevel_methods/copy_the_last_backup_of_file_lecture_information.rb +34 -0
  559. data/lib/studium/toplevel_methods/curriculum_related_code.rb +999 -0
  560. data/lib/studium/toplevel_methods/determine_local_directory_of_this_lecture.rb +72 -0
  561. data/lib/studium/toplevel_methods/does_this_course_require_mandatory_presence.rb +51 -0
  562. data/lib/studium/toplevel_methods/download.rb +163 -0
  563. data/lib/studium/toplevel_methods/e.rb +16 -0
  564. data/lib/studium/toplevel_methods/ects_from_lectures.rb +250 -0
  565. data/lib/studium/toplevel_methods/editor.rb +65 -0
  566. data/lib/studium/toplevel_methods/esystem.rb +22 -0
  567. data/lib/studium/toplevel_methods/filter_away_invalid_questions.rb +77 -0
  568. data/lib/studium/toplevel_methods/find_exam_topic_and_exam_title.rb +3442 -0
  569. data/lib/studium/toplevel_methods/handle_archive_of_the_exam_questions.rb +136 -0
  570. data/lib/studium/toplevel_methods/has_this_lecture_been_already_passed_but_the_id_was_changed_lateron.rb +42 -0
  571. data/lib/studium/toplevel_methods/has_this_module_been_completed.rb +206 -0
  572. data/lib/studium/toplevel_methods/install_the_project_on_the_given_hostsystem.rb +32 -0
  573. data/lib/studium/toplevel_methods/is_on_roebe.rb +26 -0
  574. data/lib/studium/toplevel_methods/is_this_exam_topic_included.rb +46 -0
  575. data/lib/studium/toplevel_methods/is_this_homepage_registered.rb +31 -0
  576. data/lib/studium/toplevel_methods/is_this_lecture_a_practical_course.rb +100 -0
  577. data/lib/studium/toplevel_methods/is_this_lecture_registered_in_upcoming_exams.rb +42 -0
  578. data/lib/studium/toplevel_methods/java.rb +32 -0
  579. data/lib/studium/toplevel_methods/lecture_information.rb +106 -0
  580. data/lib/studium/toplevel_methods/lva_numbers.rb +355 -0
  581. data/lib/studium/toplevel_methods/main_dataset.rb +73 -0
  582. data/lib/studium/toplevel_methods/methods_related_to_directories.rb +225 -0
  583. data/lib/studium/toplevel_methods/methods_related_to_files.rb +205 -0
  584. data/lib/studium/toplevel_methods/misc.rb +169 -0
  585. data/lib/studium/toplevel_methods/n_questions_available.rb +137 -0
  586. data/lib/studium/toplevel_methods/n_topics_available.rb +63 -0
  587. data/lib/studium/toplevel_methods/names_of_all_solved_exams.rb +71 -0
  588. data/lib/studium/toplevel_methods/note_down_the_start_time_and_how_many_exams_have_been_already_solved.rb +69 -0
  589. data/lib/studium/toplevel_methods/opnn.rb +25 -0
  590. data/lib/studium/toplevel_methods/passed_this_exam_on.rb +105 -0
  591. data/lib/studium/toplevel_methods/pristine.rb +69 -0
  592. data/lib/studium/toplevel_methods/read_delay_between_questions_from_file.rb +34 -0
  593. data/lib/studium/toplevel_methods/regexes.rb +90 -0
  594. data/lib/studium/toplevel_methods/registered_for_this_exam.rb +62 -0
  595. data/lib/studium/toplevel_methods/remove_comments.rb +26 -0
  596. data/lib/studium/toplevel_methods/remove_exam_topics_that_were_already_answered.rb +27 -0
  597. data/lib/studium/toplevel_methods/remove_tags.rb +32 -0
  598. data/lib/studium/toplevel_methods/report.rb +419 -0
  599. data/lib/studium/toplevel_methods/return_all_exams_on_this_day.rb +66 -0
  600. data/lib/studium/toplevel_methods/return_dataset_for_this_exam_topic.rb +41 -0
  601. data/lib/studium/toplevel_methods/return_div_timetable_of_upcoming_exams.rb +498 -0
  602. data/lib/studium/toplevel_methods/return_ects_from_this_lecture_stored_in_the_file_lecture_information.rb +194 -0
  603. data/lib/studium/toplevel_methods/return_hash_of_already_solved_lectures.rb +46 -0
  604. data/lib/studium/toplevel_methods/return_last_exam_question.rb +34 -0
  605. data/lib/studium/toplevel_methods/return_local_path_of_this_pwdstud.rb +60 -0
  606. data/lib/studium/toplevel_methods/return_lva_number_of_this_lecture.rb +72 -0
  607. data/lib/studium/toplevel_methods/return_n_percent_solved_from_this_topic.rb +90 -0
  608. data/lib/studium/toplevel_methods/return_n_questions_were_answered_for_this_topic.rb +60 -0
  609. data/lib/studium/toplevel_methods/return_proper_university_image.rb +86 -0
  610. data/lib/studium/toplevel_methods/return_question_answer_string_from_this_topic.rb +63 -0
  611. data/lib/studium/toplevel_methods/return_remote_homepage_of_this_lecture.rb +9400 -0
  612. data/lib/studium/toplevel_methods/return_remote_moodle_link_of_this_lecture.rb +1661 -0
  613. data/lib/studium/toplevel_methods/return_sanitized_dataset_from_the_file_lecture_information.rb +110 -0
  614. data/lib/studium/toplevel_methods/return_theme_of_the_next_upcoming_exam.rb +38 -0
  615. data/lib/studium/toplevel_methods/rinstall2.rb +34 -0
  616. data/lib/studium/toplevel_methods/rti_conflict.rb +35 -0
  617. data/lib/studium/toplevel_methods/runmode.rb +87 -0
  618. data/lib/studium/toplevel_methods/sanitized_dataset_from_file_passed_exams_per_month.rb +52 -0
  619. data/lib/studium/toplevel_methods/set_last_file_for_exam_questions.rb +64 -0
  620. data/lib/studium/toplevel_methods/set_this_cd_alias_to.rb +86 -0
  621. data/lib/studium/toplevel_methods/show_passed_exams_having_this_grade.rb +34 -0
  622. data/lib/studium/toplevel_methods/spacer.rb +18 -0
  623. data/lib/studium/toplevel_methods/time.rb +239 -0
  624. data/lib/studium/toplevel_methods/total_ects_points_passed.rb +72 -0
  625. data/lib/studium/toplevel_methods/try_to_guess_the_most_likely_lva_id.rb +57 -0
  626. data/lib/studium/toplevel_methods/try_to_return_the_expanded_name_of_this_lecture.rb +63 -0
  627. data/lib/studium/toplevel_methods/unfinished.rb +51 -0
  628. data/lib/studium/toplevel_methods/url.rb +100 -0
  629. data/lib/studium/toplevel_methods/verbose_truth.rb +36 -0
  630. data/lib/studium/toplevel_methods/when_was_this_lecture_passed.rb +54 -0
  631. data/lib/studium/toplevel_methods/word_wrap.rb +56 -0
  632. data/lib/studium/toplevel_methods/write_into_file_related_functionality.rb +189 -0
  633. data/lib/studium/toplevel_methods/yes_or_no_ja_oder_nein.rb +33 -0
  634. data/lib/studium/universities_in_austria/README.md +2 -0
  635. data/lib/studium/universities_in_austria/boku/README.md +4 -0
  636. data/lib/studium/universities_in_austria/boku/boku_/303/266ffnungszeiten.rb +28 -0
  637. data/lib/studium/universities_in_austria/boku/show_three_pillars_of_these_lectures.rb +110 -0
  638. data/lib/studium/universities_in_austria/boku/three_pillars.rb +237 -0
  639. data/lib/studium/universities_in_austria/tu_vienna/README.md +6 -0
  640. data/lib/studium/universities_in_austria/tu_vienna/tu_ferien.rb +42 -0
  641. data/lib/studium/universities_in_austria/tu_vienna/tu_/303/266ffnungszeiten.rb +34 -0
  642. data/lib/studium/utility_scripts/attribute_lecture_to_curriculum/attribute_boku_lecture_to_curriculum.rb +384 -0
  643. data/lib/studium/utility_scripts/attribute_lecture_to_curriculum/attribute_lecture_to_curriculum.rb +238 -0
  644. data/lib/studium/utility_scripts/attribute_lectures_to_university/attribute_lectures_to_university.rb +375 -0
  645. data/lib/studium/utility_scripts/audio_stats.rb +171 -0
  646. data/lib/studium/utility_scripts/auto_stud/auto_stud.rb +252 -0
  647. data/lib/studium/utility_scripts/auto_stud/constants.rb +18 -0
  648. data/lib/studium/utility_scripts/auto_stud/initialize.rb +23 -0
  649. data/lib/studium/utility_scripts/auto_stud/misc.rb +18 -0
  650. data/lib/studium/utility_scripts/autopurge_this_lecture_date.rb +93 -0
  651. data/lib/studium/utility_scripts/average_grade_of_this_curriculum.rb +101 -0
  652. data/lib/studium/utility_scripts/calendar/README.md +2 -0
  653. data/lib/studium/utility_scripts/calendar/calendar.rb +251 -0
  654. data/lib/studium/utility_scripts/calendar/misc.rb +35 -0
  655. data/lib/studium/utility_scripts/check_description_of_these_lectures.rb +221 -0
  656. data/lib/studium/utility_scripts/create_database/create_database.rb +106 -0
  657. data/lib/studium/utility_scripts/current_lectures_belonging_to_both_bachelor_and_master_curriculum.rb +113 -0
  658. data/lib/studium/utility_scripts/currently_participating_in_these_lectures/currently_participating_in_these_lectures.rb +104 -0
  659. data/lib/studium/utility_scripts/display_lecture_url.rb +160 -0
  660. data/lib/studium/utility_scripts/expand_time_range/expand_time_range.rb +414 -0
  661. data/lib/studium/utility_scripts/finished_exams_at_this_university.rb +94 -0
  662. data/lib/studium/utility_scripts/foreign_language_percentage/constants.rb +23 -0
  663. data/lib/studium/utility_scripts/foreign_language_percentage/foreign_language_percentage.rb +149 -0
  664. data/lib/studium/utility_scripts/foreign_language_percentage/help.rb +31 -0
  665. data/lib/studium/utility_scripts/foreign_language_percentage/initialize.rb +25 -0
  666. data/lib/studium/utility_scripts/foreign_language_percentage/menu.rb +158 -0
  667. data/lib/studium/utility_scripts/foreign_language_percentage/report.rb +62 -0
  668. data/lib/studium/utility_scripts/foreign_language_percentage/reset.rb +50 -0
  669. data/lib/studium/utility_scripts/foreign_language_percentage/run.rb +19 -0
  670. data/lib/studium/utility_scripts/generate_spreadsheet/generate_spreadsheet.rb +354 -0
  671. data/lib/studium/utility_scripts/generate_spreadsheet/misc.rb +144 -0
  672. data/lib/studium/utility_scripts/holidays/holidays.rb +150 -0
  673. data/lib/studium/utility_scripts/homepage_of_these_courses.rb +118 -0
  674. data/lib/studium/utility_scripts/lecture_downloader.rb +107 -0
  675. data/lib/studium/utility_scripts/lectures_attributed_to_universities.rb +336 -0
  676. data/lib/studium/utility_scripts/lva_dates_of_the_important_courses.rb +111 -0
  677. data/lib/studium/utility_scripts/lva_nummer.rb +431 -0
  678. data/lib/studium/utility_scripts/mandatory_lectures_in_this_month/mandatory_lectures_in_this_month.rb +316 -0
  679. data/lib/studium/utility_scripts/name_of_this_lva_id.rb +110 -0
  680. data/lib/studium/utility_scripts/new_stud.rb +324 -0
  681. data/lib/studium/utility_scripts/next_week.rb +103 -0
  682. data/lib/studium/utility_scripts/open_last_exam_question_url_link_via_the_browser.rb +76 -0
  683. data/lib/studium/utility_scripts/passed_ects_per_year/passed_ects_per_year.rb +177 -0
  684. data/lib/studium/utility_scripts/passed_pr/303/274fungsimmanente_courses/passed_pr/303/274fungsimmanente_courses.rb +181 -0
  685. data/lib/studium/utility_scripts/pdf/README.md +2 -0
  686. data/lib/studium/utility_scripts/pdf/create_pdf_file_for_this_exam_topic.rb +355 -0
  687. data/lib/studium/utility_scripts/pdf/hexapdf_support.rb +50 -0
  688. data/lib/studium/utility_scripts/preparatory_meetings/preparatory_meetings.rb +312 -0
  689. data/lib/studium/utility_scripts/priority.rb +164 -0
  690. data/lib/studium/utility_scripts/priority_points/priority_points.rb +263 -0
  691. data/lib/studium/utility_scripts/publish_my_exams.rb +174 -0
  692. data/lib/studium/utility_scripts/regexes/README.md +1 -0
  693. data/lib/studium/utility_scripts/regexes/generate_regex.rb +300 -0
  694. data/lib/studium/utility_scripts/regexes/generate_regexes_for_the_available_moodle_links.rb +55 -0
  695. data/lib/studium/utility_scripts/regexes/generate_regexes_for_the_registered_lectures.rb +48 -0
  696. data/lib/studium/utility_scripts/report_outdated_timetable_entries/report_outdated_timetable_entries.rb +142 -0
  697. data/lib/studium/utility_scripts/report_total_amount_of_questions_and_answers_for.rb +116 -0
  698. data/lib/studium/utility_scripts/report_whether_this_lecture_is_registered_in_the_file_lecture_information.rb +128 -0
  699. data/lib/studium/utility_scripts/resolve_practical_courses_date_conflicts/individual_resolve_practical_courses_date_conflicts.rb +254 -0
  700. data/lib/studium/utility_scripts/resolve_practical_courses_date_conflicts/resolve_practical_courses_date_conflicts.rb +265 -0
  701. data/lib/studium/utility_scripts/scrape_remote_university_url.rb +138 -0
  702. data/lib/studium/utility_scripts/semester_schedule_creator/semester_container.rb +144 -0
  703. data/lib/studium/utility_scripts/semester_schedule_creator/semester_schedule_creator.rb +374 -0
  704. data/lib/studium/utility_scripts/semesterplaner.rb +289 -0
  705. data/lib/studium/utility_scripts/set_aliases_based_on_this_file.rb +95 -0
  706. data/lib/studium/utility_scripts/show_all_passed_master_lectures.rb +119 -0
  707. data/lib/studium/utility_scripts/show_conflicting_lva_lectures/show_conflicting_lva_lectures.rb +1238 -0
  708. data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/constants.rb +23 -0
  709. data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/menu.rb +63 -0
  710. data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/reset.rb +33 -0
  711. data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/run.rb +50 -0
  712. data/lib/studium/utility_scripts/show_descriptions_of_lectures_belonging_to_this_module/show_descriptions_of_lectures_belonging_to_this_module.rb +145 -0
  713. data/lib/studium/utility_scripts/show_lecturers/show_lecturers.rb +147 -0
  714. data/lib/studium/utility_scripts/show_lectures/constants.rb +11 -0
  715. data/lib/studium/utility_scripts/show_lectures/help.rb +34 -0
  716. data/lib/studium/utility_scripts/show_lectures/initialize.rb +23 -0
  717. data/lib/studium/utility_scripts/show_lectures/menu.rb +127 -0
  718. data/lib/studium/utility_scripts/show_lectures/misc.rb +584 -0
  719. data/lib/studium/utility_scripts/show_lectures/reset.rb +89 -0
  720. data/lib/studium/utility_scripts/show_lectures/run.rb +27 -0
  721. data/lib/studium/utility_scripts/show_lectures/show_lectures.rb +48 -0
  722. data/lib/studium/utility_scripts/show_lectures_fitting_to_this_language/show_lectures_fitting_to_this_language.rb +121 -0
  723. data/lib/studium/utility_scripts/show_lectures_fitting_to_this_theme/show_lectures_fitting_to_this_theme.rb +105 -0
  724. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/constants.rb +17 -0
  725. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/determine.rb +673 -0
  726. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/help.rb +44 -0
  727. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/html.rb +605 -0
  728. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/initialize.rb +56 -0
  729. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/konsole.rb +32 -0
  730. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/menu.rb +472 -0
  731. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/misc.rb +837 -0
  732. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/reset.rb +121 -0
  733. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/run.rb +44 -0
  734. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/show.rb +106 -0
  735. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/show_lectures_on_the_commandline.rb +261 -0
  736. data/lib/studium/utility_scripts/show_lectures_on_the_commandline/sorted_individual_curricula.rb +121 -0
  737. data/lib/studium/utility_scripts/show_lectures_on_this_day.rb +149 -0
  738. data/lib/studium/utility_scripts/show_lva_dates_of_this_lecture.rb +169 -0
  739. data/lib/studium/utility_scripts/show_mixed_bachelor_master_courses/show_mixed_bachelor_master_courses.rb +91 -0
  740. data/lib/studium/utility_scripts/show_outdated_lva_dates/show_outdated_lva_dates.rb +210 -0
  741. data/lib/studium/utility_scripts/show_solved_english_lectures/show_solved_english_lectures.rb +139 -0
  742. data/lib/studium/utility_scripts/steop/README.md +4 -0
  743. data/lib/studium/utility_scripts/steop/show_all_steop_lectures.rb +93 -0
  744. data/lib/studium/utility_scripts/steop/steop_lectures_in_this_curriculum.rb +284 -0
  745. data/lib/studium/utility_scripts/steop/steop_lva_dates.rb +119 -0
  746. data/lib/studium/utility_scripts/studienkennzahl.rb +116 -0
  747. data/lib/studium/utility_scripts/studium_skeleton/studium_skeleton.rb +227 -0
  748. data/lib/studium/utility_scripts/stundenplan.rb +595 -0
  749. data/lib/studium/utility_scripts/sync_studium_relevant_entries_one_level_downwards.rb +217 -0
  750. data/lib/studium/utility_scripts/ufind/ufind.rb +98 -0
  751. data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/constants.rb +26 -0
  752. data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/run.rb +20 -0
  753. data/lib/studium/utility_scripts/upcoming_mandatory_presence_courses/upcoming_mandatory_presence_courses.rb +181 -0
  754. data/lib/studium/utility_scripts/week_parser/constants.rb +23 -0
  755. data/lib/studium/utility_scripts/week_parser/help.rb +32 -0
  756. data/lib/studium/utility_scripts/week_parser/menu.rb +59 -0
  757. data/lib/studium/utility_scripts/week_parser/misc.rb +373 -0
  758. data/lib/studium/utility_scripts/week_parser/reset.rb +65 -0
  759. data/lib/studium/utility_scripts/week_parser/run.rb +18 -0
  760. data/lib/studium/utility_scripts/week_parser/show.rb +236 -0
  761. data/lib/studium/utility_scripts/week_parser/week_parser.rb +49 -0
  762. data/lib/studium/utility_scripts/weekday_parser.rb +155 -0
  763. data/lib/studium/utility_scripts/weekly_schedule.rb +198 -0
  764. data/lib/studium/utility_scripts/wochenplanung.rb +261 -0
  765. data/lib/studium/version/version.rb +46 -0
  766. data/lib/studium/www/curricula_displayer.cgi +197 -0
  767. data/lib/studium/www/curriculum_displayer.rb +162 -0
  768. data/lib/studium/www/exams.cgi +53 -0
  769. data/lib/studium/www/fast_ask_exam_question.cgi +155 -0
  770. data/lib/studium/www/sinatra/app.rb +231 -0
  771. data/lib/studium/www/sinatra/misc.rb +115 -0
  772. data/lib/studium/www/statistics/statistics.cgi +59 -0
  773. data/lib/studium/yaml/ad_hoc_trainer/README.md +2 -0
  774. data/lib/studium/yaml/ad_hoc_trainer/exam_topics.md +15 -0
  775. data/lib/studium/yaml/allowed_themes_for_exams.yml +344 -0
  776. data/lib/studium/yaml/array_allowed_entries_for_the_file_lecture_information.yml +70 -0
  777. data/lib/studium/yaml/available_exam_topics/available_exam_topics.yml +234 -0
  778. data/lib/studium/yaml/backlog_of_exams.yml +37 -0
  779. data/lib/studium/yaml/colours/custom_colours.yml +28 -0
  780. data/lib/studium/yaml/colours/use_colours.yml +1 -0
  781. data/lib/studium/yaml/current_exams.yml +19 -0
  782. data/lib/studium/yaml/curricula/README.md +9 -0
  783. data/lib/studium/yaml/curricula/bachelor/bachelor_agrarwissenschaften_033255.yml +142 -0
  784. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_basisblock_033630.yml +65 -0
  785. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_botanik_033630.yml +84 -0
  786. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_ecology_033630.yml +74 -0
  787. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_mikrobiologie_und_genetik_033630.yml +120 -0
  788. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_molekulare_biologie_033630.yml +104 -0
  789. data/lib/studium/yaml/curricula/bachelor/bachelor_biologie_zoologie_033630.yml +87 -0
  790. data/lib/studium/yaml/curricula/bachelor/bachelor_chemie_033662.yml +165 -0
  791. data/lib/studium/yaml/curricula/bachelor/bachelor_dummy_curriculum.yml +183 -0
  792. data/lib/studium/yaml/curricula/bachelor/bachelor_elektrotechnik_und_informationstechnik_033235.yml +13 -0
  793. data/lib/studium/yaml/curricula/bachelor/bachelor_forstwirtschaft_033225.yml +115 -0
  794. data/lib/studium/yaml/curricula/bachelor/bachelor_informatik_033521.yml +130 -0
  795. data/lib/studium/yaml/curricula/bachelor/bachelor_ktww_033231.yml +84 -0
  796. data/lib/studium/yaml/curricula/bachelor/bachelor_lmbt_033217.yml +118 -0
  797. data/lib/studium/yaml/curricula/bachelor/bachelor_medizinische_informatik_033533.yml +203 -0
  798. data/lib/studium/yaml/curricula/bachelor/bachelor_molekularbiologie_033665.yml +95 -0
  799. data/lib/studium/yaml/curricula/bachelor/bachelor_nutrition_science_033638.yml +119 -0
  800. data/lib/studium/yaml/curricula/bachelor/bachelor_pharmazie_033305.yml +170 -0
  801. data/lib/studium/yaml/curricula/bachelor/bachelor_technische_chemie_033290.yml +129 -0
  802. data/lib/studium/yaml/curricula/bachelor/bachelor_technische_informatik_033535.yml +23 -0
  803. data/lib/studium/yaml/curricula/bachelor/bachelor_ubrm_033227.yml +136 -0
  804. data/lib/studium/yaml/curricula/bachelor/bachelor_verfahrenstechnik_033273.yml +167 -0
  805. data/lib/studium/yaml/curricula/bachelor/bachelor_wirtschaftsinformatik_033526.yml +29 -0
  806. data/lib/studium/yaml/curricula/individual/bachelor_informatik_und_molekulare_biologie.yml +1161 -0
  807. data/lib/studium/yaml/curricula/individual/bachelor_vector_based_strategies_in_life_sciences_molecular_medicine_and_biotechnology.yml +1157 -0
  808. data/lib/studium/yaml/curricula/individual/master_bioinformatics_and_nanobiotechnology_in_molecular_medicine.yml +306 -0
  809. data/lib/studium/yaml/curricula/individual/master_vector_based_strategies_in_life_sciences_molecular_medicine_and_biotechnology.yml +741 -0
  810. data/lib/studium/yaml/curricula/master/master_bioinformatik_066875.yml +76 -0
  811. data/lib/studium/yaml/curricula/master/master_biologie_molekulare_mikrobiologie_mikrobielle_oekologie_und_immunbiologie_066830.yml +78 -0
  812. data/lib/studium/yaml/curricula/master/master_biologische_chemie_066863.yml +61 -0
  813. data/lib/studium/yaml/curricula/master/master_dummy_curriculum.yml +197 -0
  814. data/lib/studium/yaml/curricula/master/master_genetik_und_entwicklungsbiologie_066877.yml +89 -0
  815. data/lib/studium/yaml/curricula/master/master_lmbt_066418.yml +111 -0
  816. data/lib/studium/yaml/curricula/master/master_molekulare_biologie_066834.yml +142 -0
  817. data/lib/studium/yaml/curricula/master/master_pharmazie_066605.yml +170 -0
  818. data/lib/studium/yaml/curricula/master/master_technische_chemie_066490.yml +123 -0
  819. data/lib/studium/yaml/curricula/outdated/master_bioinformatics_and_molecular_biotechnology_including_aspects_from_molecular_medicine.yml +438 -0
  820. data/lib/studium/yaml/curricula/outdated/master_food_science_and_plant_biotechnology.yml +31 -0
  821. data/lib/studium/yaml/curricula.yml +538 -0
  822. data/lib/studium/yaml/daily_questions_solved.yml +1468 -0
  823. data/lib/studium/yaml/default_delay.yml +4 -0
  824. data/lib/studium/yaml/default_encoding.yml +1 -0
  825. data/lib/studium/yaml/directory_to_the_exam_topics.yml +0 -0
  826. data/lib/studium/yaml/editor.yml +1 -0
  827. data/lib/studium/yaml/file_for_exam_questions.yml +1 -0
  828. data/lib/studium/yaml/german/README.md +2 -0
  829. data/lib/studium/yaml/german/german_to_english_month_names.yml +16 -0
  830. data/lib/studium/yaml/grouped_themes.yml +192 -0
  831. data/lib/studium/yaml/holidays.yml +194 -0
  832. data/lib/studium/yaml/important_exams.yml +226 -0
  833. data/lib/studium/yaml/inscription_dates_of_universities.yml +60 -0
  834. data/lib/studium/yaml/lecture_aliases.yml +138 -0
  835. data/lib/studium/yaml/lecture_information/lecture_information.yml +55870 -0
  836. data/lib/studium/yaml/log_dir.yml +1 -0
  837. data/lib/studium/yaml/main_topic.yml +11 -0
  838. data/lib/studium/yaml/max_stats.yml +241 -0
  839. data/lib/studium/yaml/meta_themes/README.md +13 -0
  840. data/lib/studium/yaml/meta_themes/biochemistry.md +6 -0
  841. data/lib/studium/yaml/meta_themes/bioinformatics.md +6 -0
  842. data/lib/studium/yaml/meta_themes/biotechnology.md +9 -0
  843. data/lib/studium/yaml/meta_themes/chemistry.md +9 -0
  844. data/lib/studium/yaml/meta_themes/genetics.md +10 -0
  845. data/lib/studium/yaml/meta_themes/immunology.md +5 -0
  846. data/lib/studium/yaml/meta_themes/metabolic_pathways.md +12 -0
  847. data/lib/studium/yaml/meta_themes/molecular_biology.md +9 -0
  848. data/lib/studium/yaml/meta_themes/protein_engineering.md +10 -0
  849. data/lib/studium/yaml/meta_themes/statistics.md +2 -0
  850. data/lib/studium/yaml/mitbelegung/README.md +4 -0
  851. data/lib/studium/yaml/mitbelegung/mitbelegung.yml +23 -0
  852. data/lib/studium/yaml/mitteilungsbl/303/244tter/mitteilungsbl/303/244tter.yml +363 -0
  853. data/lib/studium/yaml/n_total_questions.yml +1 -0
  854. data/lib/studium/yaml/rename_konsole_tab.yml +1 -0
  855. data/lib/studium/yaml/show_topic.yml +1 -0
  856. data/lib/studium/yaml/statistics/max_stats.yml +239 -0
  857. data/lib/studium/yaml/statistics/statistics.yml +69 -0
  858. data/lib/studium/yaml/week/01_monday.yml +5 -0
  859. data/lib/studium/yaml/week/02_tuesday.yml +75 -0
  860. data/lib/studium/yaml/week/03_wednesday.yml +62 -0
  861. data/lib/studium/yaml/week/04_thursday.yml +14 -0
  862. data/lib/studium/yaml/week/05_friday.yml +31 -0
  863. data/lib/studium/yaml/week/06_saturday.yml +16 -0
  864. data/lib/studium/yaml/week/07_sunday.yml +0 -0
  865. data/lib/studium/yaml/week/README.md +13 -0
  866. data/lib/studium.rb +5 -0
  867. data/studium.gemspec +80 -0
  868. data/test/testing_studium.rb +244 -0
  869. data/test/testing_studium_base_class.rb +17 -0
  870. data/test/testing_time_component.rb +29 -0
  871. metadata +1078 -0
@@ -0,0 +1,2710 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === Studium::Base
6
+ #
7
+ # This is the base class for other classes that are part of the Studium
8
+ # namespace.
9
+ #
10
+ # Not every class needs it though, so it is recommended to only make use
11
+ # of it if you need some "commonly shared functionality".
12
+ #
13
+ # Classes that belong to the Studium::Exams namespace should subclass
14
+ # from this class here.
15
+ # =========================================================================== #
16
+ # To require this base class, do:
17
+ #
18
+ # require 'studium/exams/base.rb'
19
+ #
20
+ # Then, to subclass from it, do:
21
+ #
22
+ # < Studium::Base
23
+ #
24
+ # In a shorter variant combining the two lines above, do this:
25
+ #
26
+ # require 'studium/base/base.rb'; < ::Studium::Base
27
+ #
28
+ # =========================================================================== #
29
+ # require 'studium/base/base.rb'
30
+ # =========================================================================== #
31
+ require 'studium/base/prototype.rb'
32
+
33
+ module Studium
34
+
35
+ class Base # === Studium::Base
36
+
37
+ # require 'studium/base/encoding.rb' # This also pulls in studium/encoding/encoding.rb
38
+ # ========================================================================= #
39
+ # We must support different encodings, so pull in the important files next.
40
+ # ========================================================================= #
41
+ require 'studium/requires/require_encoding.rb'
42
+ require 'studium/requires/require_the_studium_constants.rb'
43
+ # =========================================================================== #
44
+ # Add some important toplevel_methods files next.
45
+ # =========================================================================== #
46
+ require 'studium/toplevel_methods/available_topics.rb'
47
+ require 'studium/toplevel_methods/average_grade.rb'
48
+ require 'studium/toplevel_methods/curriculum_related_code.rb'
49
+ require 'studium/toplevel_methods/does_this_course_require_mandatory_presence.rb'
50
+ require 'studium/toplevel_methods/editor.rb'
51
+ require 'studium/toplevel_methods/esystem.rb'
52
+ require 'studium/toplevel_methods/filter_away_invalid_questions.rb'
53
+ require 'studium/toplevel_methods/find_exam_topic_and_exam_title.rb'
54
+ require 'studium/toplevel_methods/is_on_roebe.rb'
55
+ require 'studium/toplevel_methods/main_dataset.rb'
56
+ require 'studium/toplevel_methods/methods_related_to_files.rb'
57
+ require 'studium/toplevel_methods/methods_related_to_directories.rb'
58
+ require 'studium/toplevel_methods/regexes.rb'
59
+ require 'studium/toplevel_methods/remove_tags.rb'
60
+ require 'studium/toplevel_methods/return_all_exams_on_this_day.rb'
61
+ require 'studium/toplevel_methods/return_local_path_of_this_pwdstud.rb'
62
+ require 'studium/toplevel_methods/return_ects_from_this_lecture_stored_in_the_file_lecture_information.rb'
63
+ require 'studium/toplevel_methods/return_lva_number_of_this_lecture.rb'
64
+ require 'studium/toplevel_methods/return_sanitized_dataset_from_the_file_lecture_information.rb'
65
+ require 'studium/toplevel_methods/find_exam_topic_and_exam_title.rb'
66
+ require 'studium/toplevel_methods/set_this_cd_alias_to.rb'
67
+ require 'studium/toplevel_methods/spacer.rb'
68
+ require 'studium/toplevel_methods/time.rb'
69
+ require 'studium/toplevel_methods/total_ects_points_passed.rb'
70
+ require 'studium/toplevel_methods/url.rb'
71
+ require 'studium/toplevel_methods/write_into_file_related_functionality.rb'
72
+ require 'studium/toplevel_methods/yes_or_no_ja_oder_nein.rb'
73
+ require 'studium/logging/html_log_directory.rb'
74
+ require 'studium/logging/log_directory.rb'
75
+
76
+ begin
77
+ require 'colours/toplevel_methods/misc.rb'
78
+ rescue LoadError; end
79
+
80
+ # ========================================================================= #
81
+ # Add the necessary toplevel_methods:
82
+ # ========================================================================= #
83
+ require 'studium/toplevel_methods/e.rb'
84
+ require 'studium/toplevel_methods/url.rb' # Has Studium.sanitize_url().
85
+
86
+ begin
87
+ require 'opn'
88
+ rescue LoadError; end
89
+
90
+ begin
91
+ require 'roebe/requires/require_kde_konsole.rb'
92
+ rescue LoadError; end
93
+
94
+ # ========================================================================= #
95
+ # === COMMON_YEAR_DAYS_IN_MONTH
96
+ #
97
+ # This constant has the days per month, for the whole year.
98
+ #
99
+ # It will not honour leap years properly, though.
100
+ # ========================================================================= #
101
+ COMMON_YEAR_DAYS_IN_MONTH = [
102
+ nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
103
+ ]
104
+
105
+ # ========================================================================= #
106
+ # === UNICODE_RIGHT_ARROW
107
+ # ========================================================================= #
108
+ UNICODE_RIGHT_ARROW = '→'
109
+
110
+ # ========================================================================= #
111
+ # === Base::LEFT_PADDING
112
+ #
113
+ # The default padding (for showing the answer to an exam question) is
114
+ # 4 spaces since as of July 2020. In November 2020 2 spaces are now
115
+ # tried.
116
+ # ========================================================================= #
117
+ LEFT_PADDING = ' ' * 2 # 2 spaces for now.
118
+
119
+ # ========================================================================= #
120
+ # === Base::N_CHARACTERS_PER_LINE
121
+ #
122
+ # If an answer exceeds the following threshold value, then we will chop
123
+ # some bits off of it. The reason why we have defined this here in
124
+ # class Base is because at the least two other classes that are
125
+ # part of the Exam namespace, require this.
126
+ # ========================================================================= #
127
+ N_CHARACTERS_PER_LINE = 78
128
+
129
+ # ========================================================================= #
130
+ # === readlines_from_this_input_file
131
+ #
132
+ # This method is essentially File.readlines(), but we also use the
133
+ # :encoding symbol to denote which Encoding to use.
134
+ #
135
+ # As first argument pass in the file path to the target input file.
136
+ #
137
+ # You should ideally use this method in a unified way, that is, whenever
138
+ # you want to read the content of a file make use of this method here.
139
+ # This makes it easier to have the functionality all in one place.
140
+ #
141
+ # Keep in mind that the file in question has to exist locally; the
142
+ # file here will NOT check whether the given input file exists.
143
+ # ========================================================================= #
144
+ def readlines_from_this_input_file(
145
+ this_file,
146
+ use_this_encoding = :default_encoding
147
+ )
148
+ case use_this_encoding
149
+ # ======================================================================= #
150
+ # === :default
151
+ #
152
+ # This refers to the default encoding, which is usually UTF-8 (Unicode).
153
+ # ======================================================================= #
154
+ when :default,
155
+ :default_encoding
156
+ use_this_encoding = ::Studium.main_encoding?
157
+ end
158
+ if use_this_encoding.is_a? Hash
159
+ # ===================================================================== #
160
+ # === :encoding
161
+ # ===================================================================== #
162
+ if use_this_encoding.has_key? :encoding
163
+ use_this_encoding = use_this_encoding[:encoding]
164
+ end
165
+ end
166
+ File.readlines(
167
+ this_file,
168
+ encoding: use_this_encoding
169
+ )
170
+ end; alias readlines_via_default_encoding readlines_from_this_input_file # === readlines_via_default_encoding
171
+ alias readlines_with_default_encoding readlines_from_this_input_file # === readlines_with_default_encoding
172
+ alias readlines_with_the_default_encoding readlines_from_this_input_file # === readlines_with_the_default_encoding
173
+ alias readlines_with_iso_encoding readlines_from_this_input_file # === readlines_with_iso_encoding
174
+ alias file_readlines_of_this_file readlines_from_this_input_file # === file_readlines_of_this_file
175
+ alias file_readlines readlines_from_this_input_file # === file_readlines
176
+ alias readlines_with_proper_encoding readlines_from_this_input_file # === readlines_with_proper_encoding
177
+ alias proper_readlines readlines_from_this_input_file # === proper_readlines
178
+
179
+ # ========================================================================= #
180
+ # === replace_bold_token_with_default_colour
181
+ #
182
+ # This method can be used to replace <b></b> with the corresponding
183
+ # colour code on the terminal.
184
+ # ========================================================================= #
185
+ def replace_bold_token_with_default_colour(
186
+ i, use_this_colour = :mediumseagreen
187
+ )
188
+ i.gsub(
189
+ /<b>(.+)<\/b>/,
190
+ ::Colours.bold('\1')
191
+ )
192
+ end
193
+
194
+ # ========================================================================= #
195
+ # === replace_all_html_colours_in_this
196
+ #
197
+ # This method will replace all HTML colours, such as <slateblue>, with
198
+ # the corresponding RGB colour variant for the commandline. Typically
199
+ # this refers to a terminal such as the KDE konsole, and a shell such
200
+ # as bash (although other shells are fine too, and many other terminals,
201
+ # such as the gnome-terminal, most likely will work fine as well - but
202
+ # it is optimized for the KDE konsole).
203
+ #
204
+ # This method should only be called after a prior check was done, to
205
+ # determine whether the given input String at hand does indeed
206
+ # include a valid HTML colour. This can be done via a call to
207
+ # the method called line_contains_a_valid_html_colour?().
208
+ # ========================================================================= #
209
+ def replace_all_html_colours_in_this(
210
+ i,
211
+ use_this_colour_for_the_default_colour = colour_for_questions?
212
+ )
213
+ # ======================================================================= #
214
+ # bl $RUBY_COLOURS/toplevel_methods/replace_all_html_colours_in_this_line.rb
215
+ # ======================================================================= #
216
+ ::Colours.replace_all_html_colours_in_this_line(
217
+ i, use_this_colour_for_the_default_colour
218
+ )
219
+ end
220
+
221
+ # ========================================================================= #
222
+ # === colour_for_ects_points
223
+ # ========================================================================= #
224
+ def colour_for_ects_points(i = '')
225
+ ::Studium.colour_for_ects_points(i)
226
+ end; alias colourize_ects colour_for_ects_points # === colourize_ects
227
+ alias colour_ects colour_for_ects_points # === colour_ects
228
+
229
+ # ========================================================================= #
230
+ # === is_prüfungsimmanent?
231
+ #
232
+ # This method can determine whether a course is "prüfungsimmanent",
233
+ # aka whether this course requires continuous, mandatory presence
234
+ # (of the student).
235
+ #
236
+ # The argument to this method should be the type of the lecture at
237
+ # hand, such as "VO" or "VU" or "SE" or "PR", as a String.
238
+ #
239
+ # The method will always return a boolean value, aka true or
240
+ # false. If true is the return value then this means that "yes,
241
+ # this course requires mandatory presence".
242
+ # ========================================================================= #
243
+ def is_prüfungsimmanent?(
244
+ i, ignore_these_types = nil
245
+ )
246
+ Studium.is_prüfungsimmanent?(i, ignore_these_types)
247
+ end; alias is_a_prüfungsimmanent_course? is_prüfungsimmanent? # === is_a_prüfungsimmanent_course?
248
+ alias is_this_a_prüfungsimment_course? is_prüfungsimmanent? # === is_this_a_prüfungsimment_course?
249
+
250
+ # ========================================================================= #
251
+ # === return_opnn
252
+ # ========================================================================= #
253
+ def return_opnn(
254
+ use_this_namespace = NAMESPACE
255
+ )
256
+ ::Colours::GREY+
257
+ use_this_namespace+
258
+ ': '+
259
+ ::Colours::REVERT
260
+ end; alias ropnn return_opnn # === ropnn
261
+
262
+ # ========================================================================= #
263
+ # === spacer
264
+ # ========================================================================= #
265
+ def spacer
266
+ Studium.spacer
267
+ end
268
+
269
+ # ========================================================================= #
270
+ # === set_this_cd_alias_to
271
+ # ========================================================================= #
272
+ def set_this_cd_alias_to(
273
+ cd_alias, new_content, be_verbose = :default
274
+ )
275
+ Studium.set_this_cd_alias_to(cd_alias, new_content, be_verbose)
276
+ end
277
+
278
+ # ========================================================================= #
279
+ # === return_all_exams_on_this_day
280
+ # ========================================================================= #
281
+ def return_all_exams_on_this_day(i)
282
+ Studium.return_all_exams_on_this_day(i)
283
+ end
284
+
285
+ # ========================================================================= #
286
+ # === average_grade
287
+ # ========================================================================= #
288
+ def average_grade(
289
+ i = :default,
290
+ round_to = 2 # ← Round to two numbers.
291
+ )
292
+ Studium.average_grade(i, round_to)
293
+ end
294
+
295
+ # ========================================================================= #
296
+ # === html_log_dir?
297
+ # ========================================================================= #
298
+ def html_log_directory?
299
+ Studium.html_log_directory?
300
+ end; alias html_log_dir? html_log_directory? # === html_log_dir?
301
+
302
+ # ========================================================================= #
303
+ # === return_local_path_of_this_pwdstud
304
+ # ========================================================================= #
305
+ def return_local_path_of_this_pwdstud(i = 1)
306
+ Studium.return_local_path_of_this_pwdstud(i)
307
+ end
308
+
309
+ # ========================================================================= #
310
+ # === total_ects_points_passed
311
+ # ========================================================================= #
312
+ def total_ects_points_passed(i)
313
+ Studium.total_ects_points_passed(i)
314
+ end
315
+
316
+ # ========================================================================= #
317
+ # === directory_to_my_exam_topics
318
+ # ========================================================================= #
319
+ def directory_to_my_exam_topics
320
+ Studium.directory_to_my_exam_topics
321
+ end
322
+
323
+ # ========================================================================= #
324
+ # === directory_to_the_exam_topics?
325
+ # ========================================================================= #
326
+ def directory_to_the_exam_topics?
327
+ Studium.directory_to_the_exam_topics?
328
+ end; alias path_to_exam_topic? directory_to_the_exam_topics? # === path_to_exam_topic?
329
+ alias directory_of_the_exam_topics? directory_to_the_exam_topics? # === directory_of_the_exam_topics?
330
+
331
+ # ========================================================================= #
332
+ # === be_verbose?
333
+ # ========================================================================= #
334
+ def be_verbose?
335
+ @be_verbose
336
+ end
337
+
338
+ # ========================================================================= #
339
+ # === set_be_verbose
340
+ # ========================================================================= #
341
+ def set_be_verbose
342
+ @be_verbose = true
343
+ end; alias be_verbose set_be_verbose # === be_verbose
344
+
345
+ # ========================================================================= #
346
+ # === set_be_quiet
347
+ # ========================================================================= #
348
+ def set_be_quiet
349
+ @be_verbose = false
350
+ end
351
+
352
+ # ========================================================================= #
353
+ # === move_file
354
+ # ========================================================================= #
355
+ def move_file(this_file, target)
356
+ FileUtils.mv(this_file, target)
357
+ end
358
+
359
+ # ========================================================================= #
360
+ # === has_this_exam_topic_been_solved?
361
+ # ========================================================================= #
362
+ def has_this_exam_topic_been_solved?(i)
363
+ (Studium.return_n_percent_solved_from_this_topic(i).to_i == 100)
364
+ end
365
+
366
+ # ========================================================================= #
367
+ # === cpruby
368
+ # ========================================================================= #
369
+ def cpruby
370
+ base_dir = ENV['USERS']
371
+ base_dir = '/home' if base_dir.nil?
372
+ path_to_setup_rb_file =
373
+ "#{RUBY_SRC_DIR}roebe/lib/roebe/setup/setup.rb"
374
+ copy(path_to_setup_rb_file, '.')
375
+ end
376
+
377
+ # ========================================================================= #
378
+ # === rinstall2
379
+ # ========================================================================= #
380
+ def rinstall2
381
+ cpruby
382
+ system 'ruby setup.rb --quiet config'
383
+ system 'ruby setup.rb --quiet setup'
384
+ system 'ruby setup.rb --quiet install'
385
+ delete_file 'setup.rb'
386
+ delete_file 'InstalledFiles'
387
+ delete_file '.config'
388
+ end
389
+
390
+ # ========================================================================= #
391
+ # === delete_file
392
+ # ========================================================================= #
393
+ def delete_file(i)
394
+ File.delete(i) if File.exist? i
395
+ end
396
+
397
+ # ========================================================================= #
398
+ # === filter_away_invalid_questions
399
+ #
400
+ # This method will remove entries that begin with '#' and empty entries.
401
+ # ========================================================================= #
402
+ def filter_away_invalid_questions(i)
403
+ Studium.filter_away_invalid_questions(i)
404
+ end
405
+
406
+ # ========================================================================= #
407
+ # === read_in_exam_dataset_from_this_file
408
+ #
409
+ # This is the method that will read from an existing file. If a symbol
410
+ # is given then we will expand this to the default exam-topic directory.
411
+ # ========================================================================= #
412
+ def read_in_exam_dataset_from_this_file(
413
+ this_file
414
+ )
415
+ if this_file.is_a? Symbol
416
+ this_file = "#{exam_topic_directory?}#{this_file}"
417
+ end
418
+ if File.exist? this_file
419
+ dataset = readlines_via_default_encoding(this_file)
420
+ dataset = filter_away_invalid_questions(dataset)
421
+ return dataset
422
+ end
423
+ end
424
+
425
+ # ========================================================================= #
426
+ # === remove_internal_comments
427
+ # ========================================================================= #
428
+ def remove_internal_comments(i)
429
+ if i.is_a? Array
430
+ i.map {|line|
431
+ if line.include? '#'
432
+ line = line[0 .. (line.index('#')-1)]
433
+ end
434
+ line.strip
435
+ }
436
+ end
437
+ end
438
+
439
+ # ========================================================================= #
440
+ # === remove_leading_comments
441
+ # ========================================================================= #
442
+ def remove_leading_comments(i)
443
+ if i.is_a? Array
444
+ i.reject {|line| line.start_with? '#' }
445
+ end
446
+ end
447
+
448
+ # ========================================================================= #
449
+ # === remove_empty_strings
450
+ #
451
+ # This method presently only works on Arrays. We will reject empty
452
+ # Strings from the Array at hand.
453
+ # ========================================================================= #
454
+ def remove_empty_strings(i)
455
+ if i.is_a? Array
456
+ i.reject {|line| line.empty? }
457
+ end
458
+ end
459
+
460
+ # ========================================================================= #
461
+ # === return_all_numbers_from
462
+ #
463
+ # This method will return all numbers from the given input.
464
+ # ========================================================================= #
465
+ def return_all_numbers_from(i)
466
+ return_this = nil
467
+ if i.is_a? Array
468
+ return_this = i.select {|line|
469
+ line =~ /\d+/ # Any entry with a number will be returned.
470
+ }
471
+ end
472
+ return_this
473
+ end
474
+
475
+ # ========================================================================= #
476
+ # === return_all_steop_lectures
477
+ # ========================================================================= #
478
+ def return_all_steop_lectures
479
+ return_sanitized_dataset_from_the_file_lecture_information.select {|a, b|
480
+ is_a_steop_lecture = obtain(:steop, b)
481
+ is_a_steop_lecture
482
+ }
483
+ end
484
+
485
+ # ========================================================================= #
486
+ # === read_this_file_with_default_encoding
487
+ #
488
+ # This method will read in a file, that should ideally exist, in the
489
+ # default project-wide encoding.
490
+ #
491
+ # A few aliases exist to this method, such as "read_this_file()".
492
+ # ========================================================================= #
493
+ def read_this_file_with_default_encoding(
494
+ this_file
495
+ )
496
+ File.read(this_file, encoding: ::Studium.main_encoding?)
497
+ end; alias read_as_string_with_default_encoding read_this_file_with_default_encoding # === read_as_string_with_default_encoding
498
+ alias read_file read_this_file_with_default_encoding # === read_file
499
+ alias read_this_file read_this_file_with_default_encoding # === read_this_file
500
+ alias read_file_with_default_encoding read_this_file_with_default_encoding # === read_file_with_default_encoding
501
+ alias read_in_with_default_encoding read_this_file_with_default_encoding # === read_in_with_default_encoding
502
+
503
+ # ========================================================================= #
504
+ # === file_read_with_proper_encoding
505
+ # ========================================================================= #
506
+ def file_read_with_proper_encoding(this_file)
507
+ Studium.file_read_with_proper_encoding(this_file)
508
+ end
509
+
510
+ # ========================================================================= #
511
+ # === create_file
512
+ # ========================================================================= #
513
+ def create_file(i)
514
+ FileUtils.touch(i)
515
+ end; alias touch create_file # === touch
516
+
517
+ # ========================================================================= #
518
+ # === return_german_weekday_of?
519
+ # ========================================================================= #
520
+ def return_german_weekday_of?(i)
521
+ weekday?(i, :german)
522
+ end
523
+
524
+ # ========================================================================= #
525
+ # === german_date_notation
526
+ #
527
+ # Give a Range as input, and it will give us back a String that
528
+ # shows german date notation, aka DD.MM.YYYY.
529
+ # ========================================================================= #
530
+ def german_date_notation(
531
+ i, use_this_token_as_separator = '-'
532
+ )
533
+ # ======================================================================= #
534
+ # === Handle Range objects next
535
+ # ======================================================================= #
536
+ if i.is_a? Range
537
+ start_date = i.begin
538
+ end_date = i.end
539
+ start_day = start_date.day.to_s.rjust(2, '0')
540
+ start_month = start_date.month.to_s.rjust(2, '0')
541
+ start_year = start_date.year.to_s
542
+ end_day = end_date.day.to_s.rjust(2, '0')
543
+ end_month = end_date.month.to_s.rjust(2, '0')
544
+ end_year = end_date.year.to_s
545
+ i = start_day+'.'+start_month+'.'+start_year+' '+
546
+ use_this_token_as_separator+' '+
547
+ end_day+'.'+end_month+'.'+end_year
548
+ # ======================================================================= #
549
+ # === Handle Time objects next
550
+ #
551
+ # This requires no token.
552
+ # ======================================================================= #
553
+ elsif i.is_a? Time
554
+ i = "#{i.day.to_s.rjust(2, '0')}."\
555
+ "#{i.month.to_s.rjust(2, '0')}."\
556
+ "#{i.year.to_s}"
557
+ end
558
+ return i
559
+ end; alias german_notation german_date_notation # === german_notation
560
+ alias to_german_date german_date_notation # === to_german_date
561
+ alias german_formatting_for_the_date german_date_notation # === german_formatting_for_the_date
562
+
563
+ # ========================================================================= #
564
+ # === show_todays_date
565
+ # ========================================================================= #
566
+ def show_todays_date
567
+ e "Today is the #{slateblue(today?)} (#{lightgreen(weekday?)})"
568
+ e
569
+ end
570
+
571
+ # ========================================================================= #
572
+ # === return_n_questions_were_answered_for_this_topic
573
+ # ========================================================================= #
574
+ def return_n_questions_were_answered_for_this_topic(i)
575
+ Studium::Exams.return_n_questions_were_answered_for_this_topic(i)
576
+ end
577
+
578
+ # ========================================================================= #
579
+ # === day_month_year
580
+ #
581
+ # This method will return a dd.mm.yyyy notation.
582
+ #
583
+ # If you need to find out whether the given input-day is today, then
584
+ # use the method called .is_this_day_today?, defined in this file.
585
+ #
586
+ # An example for this will be:
587
+ #
588
+ # 03.04.2020
589
+ #
590
+ # ========================================================================= #
591
+ def day_month_year(
592
+ use_this_time = Time.now
593
+ )
594
+ if use_this_time.is_a? Time
595
+ use_this_time.strftime('%d.%m.%Y')
596
+ else
597
+ use_this_time
598
+ end
599
+ end; alias today? day_month_year # === today?
600
+ alias return_day_month_year day_month_year # === return_day_month_year
601
+ alias dd_mm_yyyy day_month_year # === dd_mm_yyyy
602
+ alias return_dd_mm_yyyy day_month_year # === return_dd_mm_yyyy
603
+
604
+ # ========================================================================= #
605
+ # === is_this_day_today?
606
+ #
607
+ # This method will return true or false, depending on whether the given
608
+ # input is assumed to be the present day or not.
609
+ #
610
+ # The method assumes that the input will be a Time object normally.
611
+ # ========================================================================= #
612
+ def is_this_day_today?(i = '18.02.2022')
613
+ dd_mm_yyyy(Time.now) == dd_mm_yyyy(i)
614
+ end
615
+
616
+ # ========================================================================= #
617
+ # === return_german_name_for_this_english_month
618
+ # ========================================================================= #
619
+ def return_german_name_for_this_english_month(i)
620
+ array = MONTH_NAME_ALIASES_GERMAN_TO_ENGLISH.invert
621
+ return array[i]
622
+ end
623
+
624
+ # ========================================================================= #
625
+ # === english_to_german_weekday
626
+ #
627
+ # This method will simply convert e. g. "Monday" into "Montag". In other
628
+ # words: it will convert from the english name for a day into the
629
+ # german name of that day.
630
+ # ========================================================================= #
631
+ def english_to_german_weekday(english_day)
632
+ ENGLISH_TO_GERMAN_WEEKDAYS[english_day]
633
+ end
634
+
635
+ # ========================================================================= #
636
+ # === weekdays?
637
+ #
638
+ # This method will return all weekdays, as Array, including german
639
+ # and english names for these weekdays.
640
+ # ========================================================================= #
641
+ def weekdays?
642
+ (
643
+ ARRAY_GERMAN_WEEKDAYS+
644
+ HASH_SHORT_TO_LONG_WEEKDAYS.values
645
+ ).flatten
646
+ end
647
+
648
+ # ========================================================================= #
649
+ # === german_weekdays?
650
+ # ========================================================================= #
651
+ def german_weekdays?
652
+ ARRAY_GERMAN_WEEKDAYS
653
+ end
654
+
655
+ # ========================================================================= #
656
+ # === does_this_line_include_a_german_weekday?
657
+ # ========================================================================= #
658
+ def does_this_line_include_a_german_weekday?(i)
659
+ ARRAY_GERMAN_WEEKDAYS.any? {|this_german_weekday|
660
+ i.include? this_german_weekday
661
+ }
662
+ end
663
+
664
+ # ========================================================================= #
665
+ # === remove_leading_weekday_names_from
666
+ #
667
+ # Chop away the leading weekday, e. g. "Monday", from the String at hand.
668
+ # ========================================================================= #
669
+ def remove_leading_weekday_names_from(i)
670
+ Studium.remove_leading_weekday_names_from(i)
671
+ end; alias remove_german_weekdays remove_leading_weekday_names_from # === remove_german_weekdays
672
+ alias remove_german_weekdays_from remove_leading_weekday_names_from # === remove_german_weekdays_from
673
+ alias remove_leading_weeknames remove_leading_weekday_names_from # === remove_leading_weeknames
674
+ alias remove_leading_weekdays remove_leading_weekday_names_from # === remove_leading_weekdays
675
+ alias remove_workday_from_this_input remove_leading_weekday_names_from # === remove_workday_from_this_input
676
+
677
+ # ========================================================================= #
678
+ # === is_on_roebe?
679
+ # ========================================================================= #
680
+ def is_on_roebe?
681
+ Studium.is_on_roebe?
682
+ end; alias is_roebe? is_on_roebe? # === is_roebe?
683
+ alias on_roebe? is_on_roebe? # === on_roebe?
684
+
685
+ # ========================================================================= #
686
+ # === try_to_require_the_rcfiles
687
+ # ========================================================================= #
688
+ def try_to_require_the_rcfiles
689
+ begin
690
+ require 'rcfiles'
691
+ rescue LoadError; end
692
+ end
693
+
694
+ # ========================================================================= #
695
+ # === copy (copy tag)
696
+ # ========================================================================= #
697
+ def copy(from, to)
698
+ if from.is_a? Array
699
+ from.each {|entry|
700
+ copy(entry, to)
701
+ }
702
+ else
703
+ FileUtils.copy(from, to)
704
+ end
705
+ end; alias copy_file copy # === copy_file
706
+
707
+ # ========================================================================= #
708
+ # === set_xorg_buffer
709
+ # ========================================================================= #
710
+ def set_xorg_buffer(i)
711
+ begin
712
+ require 'xorg_buffer' unless Object.const_defined?(:XorgBuffer)
713
+ XorgBuffer.set_buffer(i)
714
+ rescue LoadError
715
+ if is_on_roebe?
716
+ e 'XorgBuffer is not available - can not set the buffer.'
717
+ end
718
+ end
719
+ end
720
+
721
+ # ========================================================================= #
722
+ # === lectures_from_the_individual_vektor_curricula
723
+ #
724
+ # This method is a convenience method, returning all the lectures that
725
+ # belong to the individual bachelor+master vektor-curriculum
726
+ # ========================================================================= #
727
+ def lectures_from_the_individual_vektor_curricula
728
+ (
729
+ obtain_lectures_from_this_curriculum(:bachelor_vektor)+
730
+ obtain_lectures_from_this_curriculum(:master_vektor)
731
+ ).flatten
732
+ end
733
+
734
+ # ========================================================================= #
735
+ # === open_in_editor
736
+ # ========================================================================= #
737
+ def open_in_editor(i)
738
+ Studium.open_in_editor(i)
739
+ end
740
+
741
+ # ========================================================================= #
742
+ # === editor?
743
+ # ========================================================================= #
744
+ def editor?
745
+ Studium.editor?
746
+ end
747
+
748
+ # ========================================================================= #
749
+ # === encoding?
750
+ #
751
+ # This method will return the main encoding in use, by "pointing" towards
752
+ # the constant that keeps track of this.
753
+ # ========================================================================= #
754
+ def encoding?
755
+ ::Studium.main_encoding?
756
+ end; alias main_encoding? encoding? # === main_encoding?
757
+ alias main_encoding_to_use? encoding? # === main_encoding_to_use?
758
+ alias use_this_encoding? encoding? # === use_this_encoding?
759
+ alias encoding_to_use? encoding? # === encoding_to_use?
760
+
761
+ # ========================================================================= #
762
+ # === exit_program (exit tag)
763
+ #
764
+ # Use this method to exit from the program. It is a general "exit-operation"
765
+ # for classes in the Studium project. The reason as to why we don't just
766
+ # simply use exit() is so that we
767
+ # ========================================================================= #
768
+ def exit_program(
769
+ make_newline = :no_newline
770
+ )
771
+ case make_newline
772
+ # ======================================================================= #
773
+ # === :no_newline
774
+ # ======================================================================= #
775
+ when :no_newline
776
+ make_newline = false
777
+ end
778
+ e(N) if make_newline
779
+ exit # Exit here.
780
+ end
781
+
782
+ # ========================================================================= #
783
+ # === beautiful_url
784
+ #
785
+ # Until 10.12.2019 this exclusively used BeautifulUrl.
786
+ #
787
+ # Since as of 10.12.2019, this method will actually tap into
788
+ # Studium.return_url_from if it is registered.
789
+ # ========================================================================= #
790
+ def beautiful_url(i)
791
+ unless Studium.respond_to? :is_this_url_registered?
792
+ require 'studium/toplevel_methods/return_remote_homepage_of_this_lecture.rb'
793
+ end
794
+ if Studium.is_this_url_registered?(i)
795
+ i = Studium.return_url_from(i)
796
+ else
797
+ i = BeautifulUrl[i]
798
+ end
799
+ if i.is_a? Array
800
+ i = i.first
801
+ end
802
+ return i
803
+ end
804
+
805
+ # ========================================================================= #
806
+ # === turn_this_array_into_the_full_dataset
807
+ #
808
+ # This method accepts an Array of lectures that will be replaced with
809
+ # a full dataset.
810
+ # ========================================================================= #
811
+ def turn_this_array_into_the_full_dataset(
812
+ i, use_this_dataset
813
+ )
814
+ hash = {}
815
+ i.flatten.each {|name_of_the_lecture|
816
+ pointer = use_this_dataset[name_of_the_lecture]
817
+ hash[name_of_the_lecture] = pointer
818
+ }
819
+ hash
820
+ end
821
+
822
+ # ========================================================================= #
823
+ # === no_ext_name
824
+ #
825
+ # This method will return the name of the file (or rather the
826
+ # input given to this method) without extension.
827
+ # ========================================================================= #
828
+ def no_ext_name(i)
829
+ i.sub(/#{File.extname(i)}$/,'')
830
+ end
831
+
832
+ # ========================================================================= #
833
+ # === expand_topic
834
+ #
835
+ # This will expand e. g. 'allgemeine_genetik' to 'Allgemeine Genetik'.
836
+ # ========================================================================= #
837
+ def expand_topic(i)
838
+ Studium.find_corresponding_exam_title(i)
839
+ end; alias find_corresponding_exam_title expand_topic # === find_corresponding_exam_title
840
+
841
+ # ========================================================================= #
842
+ # === cliner (cliner tag)
843
+ #
844
+ # This method can be used such as in the following example, if a specific
845
+ # colour is wanted:
846
+ #
847
+ # cliner('*', :mediumaquamarine)
848
+ #
849
+ # ========================================================================= #
850
+ def cliner(
851
+ which_token_to_use = :default_token,
852
+ use_this_colour = nil
853
+ )
854
+ if which_token_to_use.is_a? Hash # Treat Hashes specially.
855
+ if which_token_to_use.has_key? :colours
856
+ use_this_colour = which_token_to_use.delete(:colours)
857
+ which_token_to_use = :default_token
858
+ end
859
+ end
860
+ case which_token_to_use
861
+ when :default_token
862
+ which_token_to_use = '='
863
+ end
864
+ if block_given?
865
+ yielded = yield
866
+ case yielded
867
+ # === :unicode
868
+ when :unicode
869
+ begin
870
+ require 'roebe/toplevel_methods/unicode/unicode_block_elements.rb'
871
+ which_token_to_use = Roebe.horizontal_double_bar.dup
872
+ rescue LoadError; end
873
+ end
874
+ end
875
+ result = (which_token_to_use * 80)
876
+ if use_this_colour.is_a? Symbol
877
+ if use_this_colour.to_s.include?('konsole_') or
878
+ is_this_colour_a_html_colour?(use_this_colour)
879
+ unless use_this_colour.to_s.include? '_colour_'
880
+ use_this_colour = use_this_colour.to_s
881
+ use_this_colour.sub!(/_/,'_colour_')
882
+ end
883
+ result = COLOURS.send(use_this_colour, result)
884
+ end
885
+ end
886
+ e result
887
+ end
888
+
889
+ # ========================================================================= #
890
+ # === load_yaml_dataset
891
+ #
892
+ # This method should ideally be used whenever a .yml file is to be
893
+ # loaded.
894
+ #
895
+ # The second argument can be used to rescue missing or erroneous
896
+ # yaml files.
897
+ #
898
+ # Invocation example for this is:
899
+ #
900
+ # load_yaml_dataset(:rescue)
901
+ #
902
+ # ========================================================================= #
903
+ def load_yaml_dataset(
904
+ i, do_rescue = false
905
+ )
906
+ case do_rescue
907
+ when :rescue
908
+ do_rescue = true
909
+ end
910
+ if do_rescue
911
+ begin
912
+ YAML.load_file(i)
913
+ rescue LoadError, ArgumentError; end
914
+ else
915
+ YAML.load_file(i)
916
+ end
917
+ end
918
+
919
+ # ========================================================================= #
920
+ # === sanitize_this_topic (sanitize tag, alias tag)
921
+ #
922
+ # This entry keeps all possible aliases to commonly used topics, in
923
+ # particular abbreviations.
924
+ # ========================================================================= #
925
+ def sanitize_this_topic(this_topic)
926
+ Studium.sanitize_this_theme_topic(this_topic)
927
+ end
928
+
929
+ # ========================================================================= #
930
+ # === replace_regular_numbers_with_unicode_numbers
931
+ #
932
+ # This method will replace numbers such as 1 with ¹.
933
+ # ========================================================================= #
934
+ def replace_regular_numbers_with_unicode_numbers(i)
935
+ ::Studium.replace_regular_numbers_with_unicode_numbers(i)
936
+ end
937
+
938
+ # ========================================================================= #
939
+ # === return_lectures_with_at_the_least_one_upcoming_exam
940
+ #
941
+ # This method will return all lectures that have at the least
942
+ # one upcoming exam entry. In this context "upcoming" refers
943
+ # to an exam date that comes after today (or any day before
944
+ # today).
945
+ # ========================================================================= #
946
+ def return_lectures_with_at_the_least_one_upcoming_exam
947
+ today = Time.now
948
+ return_sanitized_dataset_from_the_file_lecture_information.select {|name_of_the_course, hash_dataset|
949
+ if hash_dataset.has_key? 'exams'
950
+ exams = hash_dataset['exams']
951
+ if exams.is_a? Array
952
+ exams = exams.first
953
+ end
954
+ exams = remove_german_weekdays(exams)
955
+ exams.delete!(',')
956
+ time_parsed = Time.parse(exams)
957
+ today < time_parsed # Check that the courses are not too old.
958
+ else
959
+ false
960
+ end
961
+ }
962
+ end
963
+
964
+ # ========================================================================= #
965
+ # === create_directory
966
+ # ========================================================================= #
967
+ def create_directory(i)
968
+ FileUtils.mkdir_p(i)
969
+ end; alias mkdir create_directory # === mkdir
970
+
971
+ # ========================================================================= #
972
+ # === change_directory
973
+ # ========================================================================= #
974
+ def change_directory(
975
+ i = Dir.pwd
976
+ )
977
+ FileUtils.chdir(i)
978
+ end; alias cd change_directory # === cd
979
+
980
+ # ========================================================================= #
981
+ # === return_passed_courses
982
+ #
983
+ # This method will quickly return all passed courses.
984
+ # ========================================================================= #
985
+ def return_passed_courses
986
+ return_dataset_from_file_lecture_information.select {|key, hash|
987
+ hash.has_key?(:already_solved) and
988
+ (hash[:already_solved] == true)
989
+ }
990
+ end
991
+
992
+ # ========================================================================= #
993
+ # === return_ects_points_from_these_lectures
994
+ #
995
+ # Input to this method should be a Hash containing our lectures.
996
+ #
997
+ # An example for this is shown next:
998
+ #
999
+ # {"051010"=>"Programmierung 1",
1000
+ # "051110"=>"Mathematische Grundlagen der Informatik 1"}
1001
+ #
1002
+ # ========================================================================= #
1003
+ def return_ects_points_from_these_lectures(hash)
1004
+ n_ects_points = 0 # Keep track of the amount of ECTS points here.
1005
+ hash.each_pair {|lecture_id, name_of_the_lecture|
1006
+ # lecture_id = ensure_main_encoding(lecture_id)
1007
+ # name_of_the_lecture = ensure_main_encoding(name_of_the_lecture)
1008
+ name_of_the_lecture.squeeze!(' ')
1009
+ points = Studium.return_ects_from_this_lecture_stored_in_the_file_lecture_information(
1010
+ name_of_the_lecture, lecture_id
1011
+ )
1012
+ n_ects_points += points
1013
+ }
1014
+ return n_ects_points
1015
+ end
1016
+
1017
+ # ========================================================================= #
1018
+ # === select_lectures_with_this_key
1019
+ #
1020
+ # This method allows us to select only entries with a particular
1021
+ # key. The key has to be passed to the method and - for now - has
1022
+ # to be exactly the same as the key (e. g. string for strings
1023
+ # and symbols for symbols; no automatic conversions for now).
1024
+ #
1025
+ # The advantage of this method is that it will simplify a lot of
1026
+ # code; all code that requires us to select only specific
1027
+ # lectures.
1028
+ #
1029
+ # Usage examples:
1030
+ #
1031
+ # .select_lectures_with_this_key(:exam_registration_at)
1032
+ # .select_lectures_with_this_key(:already_solved)
1033
+ #
1034
+ # ========================================================================= #
1035
+ def select_lectures_with_this_key(
1036
+ searching_for_this_key
1037
+ )
1038
+ dataset = return_sanitized_dataset_from_the_file_lecture_information
1039
+ dataset.select! {|name_of_the_lecture, inner_hash|
1040
+ inner_hash.has_key? searching_for_this_key
1041
+ } if dataset # <- Must check here, since there may be a nil.
1042
+ return dataset
1043
+ end
1044
+
1045
+ # ========================================================================= #
1046
+ # === konsole_support?
1047
+ # ========================================================================= #
1048
+ def konsole_support?
1049
+ true
1050
+ end
1051
+
1052
+ # ========================================================================= #
1053
+ # === rename_konsole_tab?
1054
+ # ========================================================================= #
1055
+ def rename_konsole_tab?(
1056
+ i = FILE_RENAME_KONSOLE_TAB
1057
+ )
1058
+ if File.exist? i
1059
+ YAML.load_file(i)
1060
+ else
1061
+ false
1062
+ end
1063
+ end
1064
+
1065
+ # ========================================================================= #
1066
+ # === return_dataset_for_this_topic
1067
+ # ========================================================================= #
1068
+ def return_dataset_for_this_topic(i)
1069
+ Studium.return_dataset_for_this_topic(i)
1070
+ end
1071
+
1072
+ # ========================================================================= #
1073
+ # === rename_kde_konsole_tab
1074
+ # ========================================================================= #
1075
+ def rename_kde_konsole_tab(
1076
+ title = '.'
1077
+ )
1078
+ if Object.const_defined?(:Roebe) and
1079
+ Roebe.respond_to?(:rename_konsole_title_to)
1080
+ Roebe.rename_konsole_title_to(title, :be_quiet)
1081
+ end
1082
+ end
1083
+
1084
+ # ========================================================================= #
1085
+ # === last_file?
1086
+ # ========================================================================= #
1087
+ def last_file?
1088
+ _ = Studium.file_for_exam_questions
1089
+ _ = load_yaml_dataset(_).chomp
1090
+ # ======================================================================= #
1091
+ # If we are on roebe then we will use another path.
1092
+ # ======================================================================= #
1093
+ if is_on_roebe?
1094
+ _ = Studium::MY_EXAM_TOPICS+File.basename(_)
1095
+ end
1096
+ return _
1097
+ end
1098
+
1099
+ # ========================================================================= #
1100
+ # === cheering_person
1101
+ # ========================================================================= #
1102
+ def cheering_person
1103
+ '\o/'
1104
+ end; alias cheering_person? cheering_person # === cheering_person?
1105
+ alias cheering_dude? cheering_person # === cheering_dude?
1106
+
1107
+ # ========================================================================= #
1108
+ # === return_solved_lectures
1109
+ #
1110
+ # This method will return only those entries that have the key
1111
+ # :already_solved set to true.
1112
+ # ========================================================================= #
1113
+ def return_solved_lectures
1114
+ already_solved = select_lectures_with_this_key(:already_solved).select {|a,b|
1115
+ obtain(:already_solved, b) == true
1116
+ }
1117
+ already_solved
1118
+ end
1119
+
1120
+ # ========================================================================= #
1121
+ # === www_connection_is_unavailable
1122
+ # ========================================================================= #
1123
+ def www_connection_is_unavailable
1124
+ @no_connection_to_the_www = true
1125
+ end; alias www_is_unavailable www_connection_is_unavailable # === www_is_unavailable
1126
+
1127
+ # ========================================================================= #
1128
+ # === is_connected_to_the_www?
1129
+ # ========================================================================= #
1130
+ def is_connected_to_the_www?
1131
+ !@no_connection_to_the_www
1132
+ end
1133
+
1134
+ # ========================================================================= #
1135
+ # === sanitize_url
1136
+ #
1137
+ # This is such a useful method that we will use it for all subclasses
1138
+ # of Studium::Base.
1139
+ # ========================================================================= #
1140
+ def sanitize_url(i, optional_extra_modes = nil)
1141
+ Studium.sanitize_url(i, optional_extra_modes)
1142
+ end; alias sanitized_url sanitize_url # === sanitized_url
1143
+
1144
+ # ========================================================================= #
1145
+ # === web_liner
1146
+ # ========================================================================= #
1147
+ def web_liner(this_token = '*')
1148
+ (this_token * 80)+N
1149
+ end
1150
+
1151
+ # ========================================================================= #
1152
+ # === base_dir?
1153
+ #
1154
+ # This is the log dir - where we "operate on".
1155
+ # ========================================================================= #
1156
+ def base_dir?
1157
+ Studium.log_dir?
1158
+ end; alias log_dir? base_dir? # === log_dir?
1159
+
1160
+ # ========================================================================= #
1161
+ # === already_solved_this_lva_number?
1162
+ # ========================================================================= #
1163
+ def already_solved_this_lva_number?(i)
1164
+ Studium.already_solved_this_lva_number?(i)
1165
+ end
1166
+
1167
+ # ========================================================================= #
1168
+ # === return_directory_for
1169
+ #
1170
+ # This method will try to build up the most plausible, local path to
1171
+ # an existing directory.
1172
+ # ========================================================================= #
1173
+ def return_directory_for(
1174
+ name_of_the_lecture, university
1175
+ )
1176
+ Studium.return_directory_for(name_of_the_lecture, university)
1177
+ end
1178
+
1179
+ # ========================================================================= #
1180
+ # === return_steop_lectures (steop tag)
1181
+ #
1182
+ # This method will return all registered STEOP lectures.
1183
+ #
1184
+ # The optional argument will determine whether solved STEOP lectures
1185
+ # will also be returned. By default this is not the case, meaning
1186
+ # that we will ignore STEOP lectures that have already been solved.
1187
+ # ========================================================================= #
1188
+ def return_steop_lectures(
1189
+ optional_ignore_already_completed_steop_lectures = true
1190
+ )
1191
+ if ::Studium.main_dataset?
1192
+ dataset = ::Studium.main_dataset?
1193
+ else
1194
+ dataset = return_dataset_from_the_file_lecture_information
1195
+ end
1196
+ selection = dataset.select {|a, b|
1197
+ b.has_key?(:is_a_steop_lecture) and (b[:is_a_steop_lecture] == true)
1198
+ }
1199
+ if optional_ignore_already_completed_steop_lectures
1200
+ selection = selection.reject {|a, b|
1201
+ b.has_key?(:already_solved) and (b[:already_solved] == true)
1202
+ }
1203
+ end
1204
+ return selection
1205
+ end
1206
+
1207
+ # ========================================================================= #
1208
+ # === remove_newlines
1209
+ #
1210
+ # This method will remove newlines, aka "\n", from Strings and Arrays.
1211
+ # ========================================================================= #
1212
+ def remove_newlines(i)
1213
+ if i.is_a? Array
1214
+ i.map {|entry| remove_newlines(entry) }
1215
+ else
1216
+ i.delete(N)
1217
+ end
1218
+ end
1219
+
1220
+ # ========================================================================= #
1221
+ # === esystem
1222
+ # ========================================================================= #
1223
+ def esystem(i)
1224
+ if i.is_a? Array
1225
+ i.each {|entry| esystem(entry) }
1226
+ else
1227
+ Studium.esystem(i)
1228
+ end
1229
+ end
1230
+
1231
+ # ========================================================================= #
1232
+ # === append_what_into (append tag)
1233
+ #
1234
+ # Use this method to save data into a specific file.
1235
+ # ========================================================================= #
1236
+ def append_what_into(what, into)
1237
+ Studium.append_what_into(what, into)
1238
+ end
1239
+
1240
+ # ========================================================================= #
1241
+ # === ruby_src_dir_at_home?
1242
+ # ========================================================================= #
1243
+ def ruby_src_dir_at_home?
1244
+ Studium.ruby_src_dir_at_home?
1245
+ end
1246
+
1247
+ # ========================================================================= #
1248
+ # === datum?
1249
+ # ========================================================================= #
1250
+ def datum?
1251
+ Studium.datum? # ← Available in "studium/toplevel_methods/time.rb".
1252
+ end
1253
+
1254
+ # ========================================================================= #
1255
+ # === return_n_days_until_sunday
1256
+ # ========================================================================= #
1257
+ def return_n_days_until_sunday(time_now = Time.now)
1258
+ n_days_difference_from_today_to_this_day(time_now, 'Sunday')
1259
+ end
1260
+
1261
+ # ========================================================================= #
1262
+ # === return_either_grey_or_the_custom_colour_for_questions
1263
+ # ========================================================================= #
1264
+ def return_either_grey_or_the_custom_colour_for_questions
1265
+ _ = grey('').strip
1266
+ if @custom_colours and
1267
+ @custom_colours.has_key?('colour_for_questions')
1268
+ _ = COLOURS.send(@custom_colours['colour_for_questions']) { :omit_end }
1269
+ end
1270
+ _
1271
+ end
1272
+
1273
+ # ========================================================================= #
1274
+ # === replace_italic_token_with_default_colour
1275
+ # ========================================================================= #
1276
+ def replace_italic_token_with_default_colour(i, colour_to_use = :royalblue)
1277
+ replace_italic_token_with_this_colour(i, colour_to_use)
1278
+ end
1279
+
1280
+ # ========================================================================= #
1281
+ # === replace_underline_token_with_default_colour
1282
+ # ========================================================================= #
1283
+ def replace_underline_token_with_default_colour(i, colour_to_use = :royalblue)
1284
+ replace_underline_token_with_this_colour(i, colour_to_use)
1285
+ end
1286
+
1287
+ # ========================================================================= #
1288
+ # === replace_underline_token_with_this_colour
1289
+ #
1290
+ # We can use either <ud> or <u>, so we have to check for both variants.
1291
+ # ========================================================================= #
1292
+ def replace_underline_token_with_this_colour(
1293
+ i, use_this_colour = :royalblue # This default colour is rarely in use.
1294
+ )
1295
+ if (i.include?('<ud>') and i.include?('</ud>')) or
1296
+ (i.include?('<u>') and i.include?('</u>'))
1297
+ # ===================================================================== #
1298
+ # Next, set up a non-greedy explicit regex:
1299
+ #
1300
+ # https://rubular.com/r/uNnBwWc35LKjXX
1301
+ #
1302
+ # ===================================================================== #
1303
+ use_this_regex = /<ud?>([-a-züöäA-ZÜÖÄ0-9\/%, \n\.]+?)<\/ud?>/
1304
+ i = i.dup if i.frozen?
1305
+ i.gsub!(
1306
+ use_this_regex,
1307
+ ::Colours.string_underline('\1')+
1308
+ ::Colours.remove_trailing_escape_code(
1309
+ ::Colours.send(use_this_colour.to_sym, '')
1310
+ )
1311
+ )
1312
+ end
1313
+ return i
1314
+ end
1315
+
1316
+ # ========================================================================= #
1317
+ # === replace_italic_token_with_this_colour
1318
+ #
1319
+ # This method can be used to replace <i></i> with the corresponding
1320
+ # colour code on the terminal.
1321
+ # ========================================================================= #
1322
+ def replace_italic_token_with_this_colour(
1323
+ i, use_this_colour = :mediumseagreen
1324
+ )
1325
+ use_this_regex = /<it?>([A-Za-zöäüÖÄÜ\s]+)<\/it?>/ # See: https://rubular.com/r/mZb1ZtGHCLhg2U
1326
+ i.gsub(
1327
+ use_this_regex,
1328
+ ::Colours.string_italic('\1')+
1329
+ ::Colours.remove_trailing_escape_code(
1330
+ ::Colours.send(use_this_colour.to_sym, '')
1331
+ )
1332
+ )+
1333
+ ::Colours.send(use_this_colour,'')
1334
+ end
1335
+
1336
+ # ========================================================================= #
1337
+ # === try_to_require_the_open_gem
1338
+ # ========================================================================= #
1339
+ def try_to_require_the_open_gem
1340
+ begin
1341
+ require 'open'
1342
+ rescue LoadError; end
1343
+ end
1344
+
1345
+ # ========================================================================= #
1346
+ # === return_the_remote_homepage_url
1347
+ #
1348
+ # The first parameter denotes which particular lecture is to be
1349
+ # investigated, in regards to its homepage-URL.
1350
+ #
1351
+ # The second parameter should contain the hash-dataset that is to be
1352
+ # used.
1353
+ # ========================================================================= #
1354
+ def return_the_remote_homepage_url(
1355
+ of_this_lecture, dataset_to_use
1356
+ )
1357
+ of_this_lecture.strip!
1358
+ _ = dataset_to_use
1359
+ if _.has_key? :homepage
1360
+ _ = _[:homepage]
1361
+ else
1362
+ e "No :homepage entry for `#{sfancy(of_this_lecture.to_s)}`."
1363
+ end
1364
+ _
1365
+ end
1366
+
1367
+ # ========================================================================= #
1368
+ # === roebe_exam_directory?
1369
+ # ========================================================================= #
1370
+ def roebe_exam_directory?
1371
+ "#{RUBY_STUDIUM_HOME_DIR}exam_topics/"
1372
+ end
1373
+
1374
+ # ========================================================================= #
1375
+ # === remove_tags_from_this_input
1376
+ #
1377
+ # This method will return all HTML-like tags from the given input String.
1378
+ # ========================================================================= #
1379
+ def remove_tags_from_this_input(i)
1380
+ return Studium.remove_tags(i)
1381
+ end; alias remove_tags remove_tags_from_this_input # === remove_tags
1382
+
1383
+ # ========================================================================= #
1384
+ # === write_what_into
1385
+ #
1386
+ # Use this method to save data into a specific file.
1387
+ # ========================================================================= #
1388
+ def write_what_into(
1389
+ what, into, &block
1390
+ )
1391
+ Studium.write_what_into(what, into, &block)
1392
+ end; alias store_what_into write_what_into # === store_what_into
1393
+
1394
+ # ========================================================================= #
1395
+ # === return_sanitized_dataset_from_the_file_lecture_information
1396
+ #
1397
+ # This method will return the dataset stored in the file
1398
+ # 'lecture_information.yml'.
1399
+ # ========================================================================= #
1400
+ def return_sanitized_dataset_from_the_file_lecture_information
1401
+ Studium.return_sanitized_dataset_from_the_file_lecture_information
1402
+ end; alias return_dataset_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_the_file_lecture_information
1403
+ alias return_dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_file_lecture_information
1404
+ alias lecture_information_dataset return_sanitized_dataset_from_the_file_lecture_information # === lecture_information_dataset
1405
+ alias lecture_information return_sanitized_dataset_from_the_file_lecture_information # === lecture_information_dataset
1406
+ alias dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_file_lecture_information
1407
+ alias dataset_from_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_lecture_information
1408
+ alias dataset_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_lecture_information
1409
+ alias return_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_lecture_information
1410
+ alias return_data_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_data_from_the_file_lecture_information
1411
+ alias return_all_lectures return_sanitized_dataset_from_the_file_lecture_information # === return_all_lectures
1412
+ alias return_lectures_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_lectures_from_file_lecture_information
1413
+ alias dataset_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === dataset_from_the_file_lecture_information
1414
+ alias return_sanitized_dataset_from_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_sanitized_dataset_from_file_lecture_information
1415
+ alias return_dataset_from_the_lectures return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_the_lectures
1416
+ alias return_sanitized_dataset return_sanitized_dataset_from_the_file_lecture_information # === return_sanitized_dataset
1417
+ alias return_all_lectures_from_the_file_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_all_lectures_from_the_file_lecture_information
1418
+ alias return_dataset_from_lecture_information return_sanitized_dataset_from_the_file_lecture_information # === return_dataset_from_lecture_information
1419
+
1420
+ # ========================================================================= #
1421
+ # === obtain (obtain tag)
1422
+ #
1423
+ # This method will attempt to return the entry point of our main hash.
1424
+ #
1425
+ # It is optimized towards the dataset stored in the file
1426
+ # 'lecture_information.yml'.
1427
+ #
1428
+ # Typical usage example:
1429
+ #
1430
+ # curricula = obtain(:curricula, pointer_to_the_lecture_dataset)
1431
+ #
1432
+ # ========================================================================= #
1433
+ def obtain(
1434
+ this_key, hash, be_verbose = true
1435
+ )
1436
+ if block_given?
1437
+ yielded = yield
1438
+ case yielded
1439
+ # ===================================================================== #
1440
+ # === :be_quiet
1441
+ # ===================================================================== #
1442
+ when :be_quiet
1443
+ be_verbose = false
1444
+ end
1445
+ end
1446
+ case be_verbose
1447
+ when :be_quiet,
1448
+ :be_silent
1449
+ be_verbose = false
1450
+ end
1451
+ # ======================================================================= #
1452
+ # The following case menu will make use of some common popular aliases
1453
+ # or typos.
1454
+ # ======================================================================= #
1455
+ case this_key
1456
+ # ======================================================================= #
1457
+ # === :passed_when
1458
+ # ======================================================================= #
1459
+ when :passed_when,
1460
+ :solved_at
1461
+ this_key = :already_solved_at
1462
+ # ======================================================================= #
1463
+ # === :passed_successfully
1464
+ # ======================================================================= #
1465
+ when :passed_successfully
1466
+ this_key = :already_solved
1467
+ # ======================================================================= #
1468
+ # === :steop
1469
+ # ======================================================================= #
1470
+ when :steop,
1471
+ 'steop'
1472
+ this_key = :is_a_steop_lecture
1473
+ # ======================================================================= #
1474
+ # === :curricula_entries
1475
+ # ======================================================================= #
1476
+ when :curricula_entries,
1477
+ :curricula,
1478
+ 'curricula'
1479
+ this_key = 'curricula'
1480
+ # ======================================================================= #
1481
+ # === :english_description
1482
+ # ======================================================================= #
1483
+ when :english_description
1484
+ this_key = :description_in_english
1485
+ # ======================================================================= #
1486
+ # === :german_description
1487
+ # ======================================================================= #
1488
+ when :german_description
1489
+ this_key = :description_in_german
1490
+ # ======================================================================= #
1491
+ # === :this_university
1492
+ # ======================================================================= #
1493
+ when :this_university,
1494
+ :university
1495
+ this_key = :university
1496
+ # ======================================================================= #
1497
+ # === :n_ects
1498
+ # ======================================================================= #
1499
+ when :n_ects, :n_ects_points
1500
+ this_key = :ects
1501
+ # ======================================================================= #
1502
+ # === :curricula_ids
1503
+ # ======================================================================= #
1504
+ when :curricula_ids,
1505
+ :curriculum_id
1506
+ this_key = 'curricula'
1507
+ # ======================================================================= #
1508
+ # === :lecturers
1509
+ # ======================================================================= #
1510
+ when :lecturers
1511
+ this_key = 'lecturers'
1512
+ # ======================================================================= #
1513
+ # === :semester
1514
+ # ======================================================================= #
1515
+ when 'homepage',
1516
+ :remote_url
1517
+ this_key = :homepage
1518
+ # ======================================================================= #
1519
+ # === :semester
1520
+ # ======================================================================= #
1521
+ when :semester, 'semester'
1522
+ this_key = :semester
1523
+ end
1524
+ # ======================================================================= #
1525
+ # Work on any other symbols given to us next.
1526
+ # ======================================================================= #
1527
+ if this_key.is_a? Symbol
1528
+ if hash.has_key? this_key
1529
+ # All is fine.
1530
+ elsif hash.has_key? this_key.to_s
1531
+ # Else use that String as key instead.
1532
+ this_key = this_key.to_s
1533
+ end
1534
+ end
1535
+ if hash.is_a? Symbol
1536
+ e "Symbol called :#{slateblue(hash.to_s)}"
1537
+ e swarn('This is not allowed - please correct this. '\
1538
+ '(Read the next line in how to do so.)')
1539
+ e swarn('This method requires (1) first the key, (2) then the Hash.')
1540
+ exit
1541
+ elsif hash.is_a?(Hash) and hash.has_key?(this_key)
1542
+ hash[this_key] # Return this.
1543
+ else
1544
+ if be_verbose
1545
+ case this_key
1546
+ when :is_a_steop_lecture
1547
+ # Exceptions - these keys ^^^ will NOT be shown.
1548
+ else
1549
+ e "In file #{sfile('base.rb')}, method: obtain() → No key found, "\
1550
+ "called `#{this_key.to_s}` (class '#{this_key.class.to_s})"
1551
+ e 'The hash was:'
1552
+ e
1553
+ pp hash
1554
+ e
1555
+ end
1556
+ end
1557
+ nil
1558
+ end
1559
+ end; alias obtain_this_value_from_hash obtain # === obtain_this_value_from_hash
1560
+ alias obtain_from obtain # === obtain_from
1561
+
1562
+ # ========================================================================= #
1563
+ # === opnn
1564
+ #
1565
+ # The method also handles blocks.
1566
+ # ========================================================================= #
1567
+ def opnn(
1568
+ i = @namespace,
1569
+ &block
1570
+ )
1571
+ if use_opn?
1572
+ if i.is_a? String # "Turn" it into a Hash here.
1573
+ i = { namespace: i }
1574
+ end
1575
+ Opn.opn(i, &block)
1576
+ end
1577
+ end
1578
+
1579
+ # ========================================================================= #
1580
+ # === enable_debug
1581
+ # ========================================================================= #
1582
+ def enable_debug
1583
+ @debug = true
1584
+ end; alias do_debug enable_debug # === do_debug
1585
+
1586
+ # ========================================================================= #
1587
+ # === debug?
1588
+ # ========================================================================= #
1589
+ def debug?
1590
+ @debug
1591
+ end
1592
+
1593
+ # ========================================================================= #
1594
+ # === be_silent
1595
+ # ========================================================================= #
1596
+ def be_silent
1597
+ @be_verbose = false
1598
+ end; alias be_quiet be_silent # === be_quiet
1599
+
1600
+ # ========================================================================= #
1601
+ # === is_a_weekday?
1602
+ #
1603
+ # This method will return true if the input is a String that represents
1604
+ # a weekday, such as "Monday". Otherwise, false will be returned.
1605
+ #
1606
+ # Both german and english variants are allowed here.
1607
+ # ========================================================================= #
1608
+ def is_a_weekday?(i = 'Montag')
1609
+ result = false
1610
+ if ARRAY_GERMAN_WEEKDAYS.include? i
1611
+ result = true
1612
+ elsif ARRAY_ENGLISH_WEEKDAYS.include? i
1613
+ result = true
1614
+ end
1615
+ return result
1616
+ end
1617
+
1618
+ # ========================================================================= #
1619
+ # === do_not_be_verbose
1620
+ # ========================================================================= #
1621
+ def do_not_be_verbose
1622
+ @be_verbose = false
1623
+ end
1624
+
1625
+ # ========================================================================= #
1626
+ # === @use_opn
1627
+ # ========================================================================= #
1628
+ def use_opn?
1629
+ @use_opn
1630
+ end
1631
+
1632
+ # ========================================================================= #
1633
+ # === do_not_use_opn
1634
+ # ========================================================================= #
1635
+ def do_not_use_opn
1636
+ @use_opn = false
1637
+ end
1638
+
1639
+ # ========================================================================= #
1640
+ # === studium_directory_at_home?
1641
+ # ========================================================================= #
1642
+ def studium_directory_at_home?
1643
+ Studium.studium_directory_at_home?
1644
+ end; alias studium_directory_at_home? studium_directory_at_home? # === studium_directory_at_home?
1645
+
1646
+ # ========================================================================= #
1647
+ # === etomato
1648
+ # ========================================================================= #
1649
+ def etomato(i)
1650
+ e tomato(i)
1651
+ end
1652
+
1653
+ # ========================================================================= #
1654
+ # === is_this_a_valid_html_colour?
1655
+ #
1656
+ # This method will let us know whether the given input is a valid (aka
1657
+ # registered) "html colour". An example for this would be the String
1658
+ # 'slateblue'.
1659
+ # ========================================================================= #
1660
+ def is_this_a_valid_html_colour?(i)
1661
+ ::Studium.is_this_a_valid_html_colour?(i)
1662
+ end; alias is_this_colour_a_html_colour? is_this_a_valid_html_colour? # === is_this_colour_a_html_colour?
1663
+
1664
+ # ========================================================================= #
1665
+ # === eparse
1666
+ #
1667
+ # The colours for this method are defined within the method body.
1668
+ #
1669
+ # We could also delegate to ::Colours.eparse() instead.
1670
+ # ========================================================================= #
1671
+ def eparse(i)
1672
+ if use_colours?
1673
+ token = '#'
1674
+ if i.include? token
1675
+ splitted = i.split(token)
1676
+ splitted[-1] = olive(splitted[-1])
1677
+ i = splitted.join(royalblue(token))
1678
+ end
1679
+ end
1680
+ e i
1681
+ end
1682
+
1683
+ # ========================================================================= #
1684
+ # === colourize_percentage
1685
+ #
1686
+ # This method should be used when we wish to display percentage
1687
+ # values on the commandline.
1688
+ # ========================================================================= #
1689
+ def colourize_percentage(i)
1690
+ return seagreen(i) if use_colours? # Used to be cadetblue.
1691
+ return i
1692
+ end
1693
+
1694
+ # ========================================================================= #
1695
+ # === remove_escape_sequences
1696
+ # ========================================================================= #
1697
+ def remove_escape_sequences(i)
1698
+ ::Colours.remove_escape_sequences(i)
1699
+ end
1700
+
1701
+ # ========================================================================= #
1702
+ # === this_month_has_n_days?
1703
+ #
1704
+ # This method will return the maximum amount of days in the given
1705
+ # month.
1706
+ # ========================================================================= #
1707
+ def this_month_has_n_days?(
1708
+ this_month,
1709
+ this_year = Time.now.year
1710
+ )
1711
+ this_month = this_month.to_i
1712
+ return 29 if this_month == 2 && Date.gregorian_leap?(this_year)
1713
+ COMMON_YEAR_DAYS_IN_MONTH[this_month]
1714
+ end
1715
+
1716
+ # ========================================================================= #
1717
+ # === return_dd_mm_yy_and_time_from
1718
+ #
1719
+ # This method will return the day, in dd.mm.yyyy format, and the
1720
+ # time on that date. You have to pass in a special object to this
1721
+ # method, such as an instance of class Time - see methods used
1722
+ # such as .day() or .month() and so forth.
1723
+ # ========================================================================= #
1724
+ def return_dd_mm_yy_and_time_from(i)
1725
+ Studium.return_dd_mm_yy_and_time_from(i)
1726
+ end
1727
+
1728
+ require 'studium/toplevel_methods/word_wrap.rb'
1729
+ # ========================================================================= #
1730
+ # === word_wrap
1731
+ #
1732
+ # This method can re-arrange a given text (a String) to honour a certain
1733
+ # size limit, such as 80 characters per line.
1734
+ #
1735
+ # Keep in mind that colours that may be used inside of a tag, such as
1736
+ # <tomato>foobar</tomato>, will also count for that limit. This has
1737
+ # to be remembered when doing the calculation for text-wrapping.
1738
+ # ========================================================================= #
1739
+ def word_wrap(
1740
+ text,
1741
+ line_width = N_CHARACTERS_PER_LINE
1742
+ )
1743
+ ::Studium.word_wrap(text, line_width)
1744
+ end
1745
+
1746
+ # ========================================================================= #
1747
+ # === vertical_bar?
1748
+ # ========================================================================= #
1749
+ def vertical_bar?
1750
+ return '|'
1751
+ end
1752
+
1753
+ # ========================================================================= #
1754
+ # === horizontal_bar?
1755
+ # ========================================================================= #
1756
+ def horizontal_bar?
1757
+ return '―'
1758
+ end
1759
+
1760
+ # ========================================================================= #
1761
+ # === shall_we_make_use_of_unicode_symbols?
1762
+ #
1763
+ # The most common idiom for using this method is actually via:
1764
+ #
1765
+ # if use_unicode_symbols?
1766
+ #
1767
+ # ========================================================================= #
1768
+ def shall_we_make_use_of_unicode_symbols?
1769
+ ::Studium.shall_we_make_use_of_unicode_symbols?
1770
+ end; alias use_unicode_symbols? shall_we_make_use_of_unicode_symbols? # === use_unicode_symbols?
1771
+ alias use_unicode? shall_we_make_use_of_unicode_symbols? # === use_unicode?
1772
+
1773
+ # ========================================================================= #
1774
+ # === unicode_blocks_line
1775
+ #
1776
+ # This method will "draw" a (horizontal) unicode-blocks line, that is,
1777
+ # a line that is "built" from unicode blocks.
1778
+ #
1779
+ # The optional first argument can be used to use a specific colour.
1780
+ #
1781
+ # Usage examples:
1782
+ #
1783
+ # unicode_blocks_line :steelblue
1784
+ # unicode_blocks_line(:steelblue) {{ n_tokens: 84 }}
1785
+ #
1786
+ # ========================================================================= #
1787
+ def unicode_blocks_line(
1788
+ optional_use_this_colour = nil,
1789
+ use_n_tokens = :default, # <- This defaults to 78.
1790
+ use_this_unicode_token = :upper_half_block
1791
+ )
1792
+ case use_n_tokens
1793
+ when :default # Must come before we check for a given block.
1794
+ use_n_tokens = 78
1795
+ end
1796
+ if block_given?
1797
+ yielded = yield
1798
+ if yielded.is_a? Hash
1799
+ if yielded.has_key? :n_tokens
1800
+ use_n_tokens = yielded.delete(:n_tokens)
1801
+ end
1802
+ end
1803
+ end
1804
+ begin
1805
+ require 'roebe/toplevel_methods/unicode/unicode_block_elements.rb'
1806
+ rescue LoadError; end
1807
+ _ = (Roebe.send(use_this_unicode_token) * use_n_tokens)
1808
+ if optional_use_this_colour
1809
+ _ = ::Colours::AllColourMethods.send(optional_use_this_colour, _)
1810
+ end
1811
+ return _
1812
+ end
1813
+
1814
+ # ========================================================================= #
1815
+ # === return_hh_mm_ss_from
1816
+ #
1817
+ # Input to this method may be like this:
1818
+ #
1819
+ # 2020-03-04 00:00:00 +0000
1820
+ #
1821
+ # It will then return the ss:mm:hh notation.
1822
+ # ========================================================================= #
1823
+ def return_hh_mm_ss_from(i)
1824
+ if i.is_a? String
1825
+ i = Time.parse(i)
1826
+ end
1827
+ if i.is_a? Time
1828
+ "#{i.hour.to_s.rjust(2,'0')}:"\
1829
+ "#{i.min.to_s.rjust(2,'0')}:"\
1830
+ "#{i.sec.to_s.rjust(2,'0')}"
1831
+ else
1832
+ e 'Unknown time format.'
1833
+ end
1834
+ end; alias hh_mm_ss return_hh_mm_ss_from # === hh_mm_ss
1835
+
1836
+ # ========================================================================= #
1837
+ # === hh_mm_ss_dd_mm_yyyy
1838
+ # ========================================================================= #
1839
+ def hh_mm_ss_dd_mm_yyyy(i)
1840
+ "#{hh_mm_ss(i)}-#{dd_mm_yyyy(i)}"
1841
+ end
1842
+
1843
+ # ========================================================================= #
1844
+ # === german_weekday?
1845
+ #
1846
+ # This method will return a german weekday, for the given input. The
1847
+ # input should be the specific wday at hand.
1848
+ # ========================================================================= #
1849
+ def german_weekday?(
1850
+ i = Date.today.wday
1851
+ )
1852
+ weekday?(i, :german)
1853
+ end; alias weekday_at german_weekday? # === weekday_at
1854
+ alias german_weekday german_weekday? # === german_weekday
1855
+
1856
+ # ========================================================================= #
1857
+ # === directory_to_the_exam_topics?
1858
+ #
1859
+ # This method will point to the directory where all exam topics
1860
+ # are normally kept; it is simply a "wrapper-method".
1861
+ # ========================================================================= #
1862
+ def directory_to_the_exam_topics?
1863
+ Studium.directory_to_the_exam_topics?
1864
+ end; alias exam_topics_directory? directory_to_the_exam_topics? # === exam_topics_directory?
1865
+ alias exam_topic_directory? directory_to_the_exam_topics? # === exam_topic_directory?
1866
+
1867
+ # ========================================================================= #
1868
+ # === return_title_from_this_curriculum_file
1869
+ #
1870
+ # The first argument to this method should be the abbreviation of
1871
+ # that particular curriculum.
1872
+ #
1873
+ # Usage example:
1874
+ #
1875
+ # return_title_from_this_curriculum_file(:indi2)
1876
+ #
1877
+ # ========================================================================= #
1878
+ def return_title_from_this_curriculum_file(
1879
+ i,
1880
+ use_a_shorter_name = false
1881
+ )
1882
+ Studium.return_title_from_this_curriculum_file(i, use_a_shorter_name)
1883
+ end; alias return_title_of return_title_from_this_curriculum_file # === return_title_of
1884
+ alias return_pretty_title_of_this_curriculum return_title_from_this_curriculum_file # === return_pretty_title_of_this_curriculum
1885
+
1886
+ # ========================================================================= #
1887
+ # === lectures_from_indi1
1888
+ # ========================================================================= #
1889
+ def lectures_from_indi1
1890
+ obtain_lectures_from_this_curriculum(:indi1)
1891
+ end
1892
+
1893
+ # ========================================================================= #
1894
+ # === lectures_from_indi2
1895
+ # ========================================================================= #
1896
+ def lectures_from_indi2
1897
+ obtain_lectures_from_this_curriculum(:indi2)
1898
+ end
1899
+
1900
+ # ========================================================================= #
1901
+ # === lectures_from_indi3
1902
+ # ========================================================================= #
1903
+ def lectures_from_indi3
1904
+ obtain_lectures_from_this_curriculum(:indi3)
1905
+ end
1906
+
1907
+ # ========================================================================= #
1908
+ # === lectures_from_indi4
1909
+ # ========================================================================= #
1910
+ def lectures_from_indi4
1911
+ obtain_lectures_from_this_curriculum(:indi4)
1912
+ end
1913
+
1914
+ # ========================================================================= #
1915
+ # === return_file_for_this_curriculum
1916
+ # ========================================================================= #
1917
+ def return_file_for_this_curriculum(
1918
+ i = :bachelor_basisblock_biologie
1919
+ )
1920
+ if i.is_a? Array
1921
+ i.map {|line|
1922
+ return_file_for_this_curriculum(line)
1923
+ }
1924
+ else
1925
+ # ===================================================================== #
1926
+ #
1927
+ # bl $RUBY_STUDIUM/constants/return_file_for_this_curriculum.rb
1928
+ #
1929
+ # ===================================================================== #
1930
+ Studium.return_file_for_this_curriculum(i)
1931
+ end
1932
+ end; alias return_curriculum_file_based_on_this_input return_file_for_this_curriculum # === return_curriculum_file_based_on_this_input
1933
+ alias curriculum_location_of return_file_for_this_curriculum # === curriculum_location_of
1934
+ alias return_path_of_this_curriculum return_file_for_this_curriculum # === return_path_of_this_curriculum
1935
+ alias return_file_associated_with_this_curriculum return_file_for_this_curriculum # === return_file_associated_with_this_curriculum
1936
+ alias location_of_this_curriculum_file? return_file_for_this_curriculum # === location_of_this_curriculum_file?
1937
+
1938
+ # ========================================================================= #
1939
+ # === return_random_curriculum
1940
+ # ========================================================================= #
1941
+ def return_random_curriculum
1942
+ ::Studium.return_random_curriculum
1943
+ end
1944
+
1945
+ # ========================================================================= #
1946
+ # === lectures_from_the_bachelor_genetik_curriculum
1947
+ # ========================================================================= #
1948
+ def lectures_from_the_bachelor_genetik_curriculum
1949
+ obtain_lectures_from_this_curriculum(:bachelor_genetik_curriculum)
1950
+ end
1951
+
1952
+ # ========================================================================= #
1953
+ # === return_lectures_from_bachelor_vektor_curriculum
1954
+ # ========================================================================= #
1955
+ def return_lectures_from_bachelor_vektor_curriculum
1956
+ obtain_lectures_from_this_curriculum(:bachelor_vektor)
1957
+ end
1958
+
1959
+ # ========================================================================= #
1960
+ # === convert_this_array_of_lectures_into_the_full_dataset
1961
+ #
1962
+ # The purpose of this method is to turn an Array that holds Strings
1963
+ # such as "941111 Genetische Ressourcen von Nutzpflanzen" into the
1964
+ # corresponding dataset.
1965
+ #
1966
+ # This method will return a Hash if everything went fine.
1967
+ # ========================================================================= #
1968
+ def convert_this_array_of_lectures_into_the_full_dataset(i)
1969
+ if i.is_a? Array
1970
+ if Studium.main_dataset?.nil?
1971
+ Studium.initialize_main_dataset
1972
+ end
1973
+ _ = Studium.main_dataset?
1974
+ hash = {}
1975
+ i.map {|course_id_and_course_name|
1976
+ if _.has_key?(course_id_and_course_name)
1977
+ hash[course_id_and_course_name] = _[course_id_and_course_name]
1978
+ end
1979
+ }
1980
+ hash
1981
+ else
1982
+ raise 'This method only accepts an Array as input.'
1983
+ end
1984
+ end
1985
+
1986
+ # ========================================================================= #
1987
+ # === weekday?
1988
+ #
1989
+ # This method will return a String such as "Thursday". Note that the
1990
+ # english name will be returned by default. This can be changed via
1991
+ # the second parameter to this method, which can be either :english
1992
+ # or :german.
1993
+ #
1994
+ # The input to this method should be a number, such as can be obtained
1995
+ # via the method .wday().
1996
+ #
1997
+ # A String can also be passed into this method, in a form like
1998
+ # "dd.mm.yyyy". So, an input String such as "10.03.2018" is
1999
+ # perfectly valid.
2000
+ # ========================================================================= #
2001
+ def weekday?(
2002
+ i = Date.today.wday,
2003
+ use_this_language = :english
2004
+ )
2005
+ if i.is_a?(String) and i.include?('.')
2006
+ # ===================================================================== #
2007
+ # In this case here assume an input-String such as "12.03.2018".
2008
+ # ===================================================================== #
2009
+ begin
2010
+ i = Time.parse(i).wday
2011
+ rescue ArgumentError => error
2012
+ pp error
2013
+ end
2014
+ end
2015
+ result = Date::DAYNAMES[i]
2016
+ case use_this_language
2017
+ # ======================================================================= #
2018
+ # === :german
2019
+ # ======================================================================= #
2020
+ when :german,
2021
+ :use_german
2022
+ # ===================================================================== #
2023
+ # In this case we have to translate to the german name.
2024
+ # ===================================================================== #
2025
+ result = ENGLISH_TO_GERMAN_WEEKDAYS[result]
2026
+ end
2027
+ return result
2028
+ end; alias return_name_for_this_day weekday? # === return_name_for_this_day
2029
+ alias return_weekday_for weekday? # === return_weekday_for
2030
+ alias return_weekday_of weekday? # === return_weekday_of
2031
+ alias return_weekday_from_this_input weekday? # === return_weekday_from_this_input
2032
+ alias english_weekday weekday? # === english_weekday
2033
+ alias english_weekday? weekday? # === english_weekday?
2034
+
2035
+ # ========================================================================= #
2036
+ # === remove_weekday_names_from
2037
+ #
2038
+ # This method will remove Strings such as "Monday" or "Montag" from
2039
+ # the given input argument.
2040
+ # ========================================================================= #
2041
+ def remove_weekday_names_from(i)
2042
+ Studium.remove_weekday_names_from(i)
2043
+ end; alias remove_weekname_from remove_weekday_names_from # === remove_weekname_from
2044
+ alias remove_weekdays remove_weekday_names_from # === remove_weekdays
2045
+ alias remove_weekday_names_from remove_weekday_names_from # === remove_weekday_names_from
2046
+ alias remove_weeknames_from remove_weekday_names_from # === remove_weeknames_from
2047
+ alias remove_weeknames remove_weekday_names_from # === remove_weeknames
2048
+ alias remove_weekday_name remove_weekday_names_from # === remove_weekday_name
2049
+
2050
+ # ========================================================================= #
2051
+ # === return_hour_from_this
2052
+ #
2053
+ # This method will extract the time-format from a String,
2054
+ # such as:
2055
+ #
2056
+ # "18.02.2020, 17:00-18:00"
2057
+ # "Dienstag 13.10.2020, 14:30-17:45"
2058
+ #
2059
+ # A String will be returned in this event, holding the start and
2060
+ # stop time - for instance, in the first example it would return
2061
+ # the String "17:00-18:00".
2062
+ #
2063
+ # A String should be given as argument to this method.
2064
+ # ========================================================================= #
2065
+ def return_hour_from_this(i)
2066
+ i.scan(
2067
+ /\d{2}:\d{2}-\d{2}:\d{2}/
2068
+ ).flatten.first.to_s.strip
2069
+ end; alias extract_the_time_from return_hour_from_this # === extract_the_time
2070
+
2071
+ # ========================================================================= #
2072
+ # === sort_these_lecture_names_by_time
2073
+ # ========================================================================= #
2074
+ def sort_these_lecture_names_by_time(
2075
+ array, weekday
2076
+ )
2077
+ _ = main_dataset?
2078
+ array.sort_by {|entry|
2079
+ pointer = _[entry]
2080
+ lva_date = pointer['lva_dates'].select {|inner_entry|
2081
+ inner_entry.include? weekday
2082
+ }
2083
+ lva_date = lva_date.first if lva_date.is_a? Array
2084
+ lva_date = return_hour_from_this(lva_date) # This will be like "08:00-09:45"
2085
+ # ===================================================================== #
2086
+ # However had, we only need the last part, so chop it down.
2087
+ # ===================================================================== #
2088
+ if lva_date.include? '-'
2089
+ lva_date = lva_date.split('-').first
2090
+ end
2091
+ timestamp = Time.parse(lva_date)
2092
+ timestamp # And "return" it here.
2093
+ }
2094
+ end
2095
+
2096
+ # ========================================================================= #
2097
+ # === number_to_month
2098
+ #
2099
+ # This method will convert a number, such as 6, to the corresponding
2100
+ # month entry.
2101
+ # ========================================================================= #
2102
+ def number_to_month(i)
2103
+ array = Date::MONTHNAMES
2104
+ i = i.to_i
2105
+ return array[i]
2106
+ end
2107
+
2108
+ # ========================================================================= #
2109
+ # === return_this_line_has_n_characters_as_html_colour_tags
2110
+ # ========================================================================= #
2111
+ def return_this_line_has_n_characters_as_html_colour_tags(i)
2112
+ i.scan(REGEX_FOR_OPENING_AND_CLOSING_COLOUR_TAGS).map {|entry|
2113
+ entry.size
2114
+ }.sum
2115
+ end
2116
+
2117
+ # ========================================================================= #
2118
+ # === does_this_line_include_a_html_colour?
2119
+ # ========================================================================= #
2120
+ def does_this_line_include_a_html_colour?(i)
2121
+ ::Colours.does_this_line_include_a_html_colour?(i)
2122
+ end
2123
+
2124
+ # ========================================================================= #
2125
+ # === translate_dd_mm_yyyy_to_weekday
2126
+ #
2127
+ # This method will return the weekday of a given dd.mm.yyyy date.
2128
+ #
2129
+ # If the given input is, for example, the String '25.02.2019', then
2130
+ # this method will return the String 'Monday'.
2131
+ # ========================================================================= #
2132
+ def translate_dd_mm_yyyy_to_weekday(
2133
+ i = '25.02.2020'
2134
+ )
2135
+ weekday?(i)
2136
+ end; alias translate_dd_mm_yyy_to_weekday translate_dd_mm_yyyy_to_weekday # === translate_dd_mm_yyy_to_weekday
2137
+
2138
+ # ========================================================================= #
2139
+ # === return_name_of_the_weekday
2140
+ #
2141
+ # This method can be used to return an associated weekday to a specific
2142
+ # date, such as '22.02.2018'. The format has to be in dd.mm.yyyy.
2143
+ # ========================================================================= #
2144
+ def return_name_of_the_weekday(
2145
+ i = :today
2146
+ )
2147
+ begin
2148
+ require 'roebe/constants/time.rb'
2149
+ rescue LoadError; end
2150
+ case i
2151
+ # ======================================================================= #
2152
+ # === :today
2153
+ # ======================================================================= #
2154
+ when :today
2155
+ i = Roebe.return_german_weekday(i) if Object.const_defined? :Roebe
2156
+ end
2157
+ if i.include? ','
2158
+ splitted = i.split(',')
2159
+ first = splitted.first
2160
+ if first.count('.') > 1
2161
+ return Roebe.return_german_weekday(first) if Object.const_defined? :Roebe
2162
+ end
2163
+ else
2164
+ return i
2165
+ end
2166
+ end; alias return_weekday return_name_of_the_weekday # === return_weekday
2167
+
2168
+ # ========================================================================= #
2169
+ # === return_month_fitting_to_this_input
2170
+ #
2171
+ # This method will return a number.
2172
+ # ========================================================================= #
2173
+ def return_month_fitting_to_this_input(i)
2174
+ i = i.capitalize
2175
+ if MONTH_NAME_TO_MONTH_NUMBER.has_key? i
2176
+ i = MONTH_NAME_TO_MONTH_NUMBER[i]
2177
+ end
2178
+ return i.to_i
2179
+ end
2180
+
2181
+ # ========================================================================= #
2182
+ # === extract_dd_mm_yyyy
2183
+ #
2184
+ # This method can be used to extract the dd.mm.yyyy format from the given
2185
+ # input at hand. It will discard everything else.
2186
+ #
2187
+ # So, for instance, if the input is "15.10.2018, 09:00-18:00" then
2188
+ # this method will return only "15.10.2018".
2189
+ # ========================================================================= #
2190
+ def extract_dd_mm_yyyy(i)
2191
+ i =~ /(\d{1,2}\.\d{1,2}\.\d{4})/ # This will also generate a match.
2192
+ $1.to_s.dup
2193
+ end; alias extract_ddmmyyyy extract_dd_mm_yyyy # === extract_ddmmyyyy
2194
+
2195
+ # ========================================================================= #
2196
+ # === has_year_entry?
2197
+ #
2198
+ # This method will return a Boolean.
2199
+ #
2200
+ # It will return true if the line has a year entry such as '2018'; and
2201
+ # it will return false, otherwise.
2202
+ # ========================================================================= #
2203
+ def has_year_entry?(this_line)
2204
+ this_line =~ /\d{4}/ # If this line has at the least one entry with 4 numbers.
2205
+ end; alias this_line_has_a_year_entry? has_year_entry? # === has_year_entry?
2206
+
2207
+ # ========================================================================= #
2208
+ # === add_proper_year_entry_to_this_line
2209
+ #
2210
+ # This method will add a proper year entry to a line. It will either
2211
+ # append a year entry - or, which may be more useful, try to insert
2212
+ # the year-entry into a position that fits. The latter will make
2213
+ # use of a regex.
2214
+ #
2215
+ # A test string for the latter is the following:
2216
+ #
2217
+ # "Dienstag 02.10. 11:30-13:00 UZA2 Hörsaal 5 Raum 2Z202 2.OG"
2218
+ #
2219
+ # ========================================================================= #
2220
+ def add_proper_year_entry_to_this_line(line)
2221
+ result = line.dup
2222
+ current_year = Time.now.year
2223
+ use_this_regex = # See: http://rubular.com/r/xV0yNSYhWW
2224
+ /^(.+)(\d{2}\.\d{1,2}\.) (\d{1,2}:\d{1,2}(-| )?\d{1,2}:\d{1,2})(.+)$/
2225
+ if result =~ use_this_regex
2226
+ result.sub!(use_this_regex, '\1\2'+current_year.to_s+', \3\5')
2227
+ else # this here is the simpler case
2228
+ result << current_year # This is the variant that will simply append.
2229
+ end
2230
+ result
2231
+ end
2232
+
2233
+ # ========================================================================= #
2234
+ # === return_n_days_until_monday
2235
+ # ========================================================================= #
2236
+ def return_n_days_until_monday(
2237
+ time_now = Time.now
2238
+ )
2239
+ n_days_difference_from_today_to_this_day(time_now, 'Monday')
2240
+ end
2241
+
2242
+ # ========================================================================= #
2243
+ # === n_days_difference_from_today_to_this_day
2244
+ #
2245
+ # This method will return a number, which is the amount of days between
2246
+ # weekdays.
2247
+ #
2248
+ # The days are numbered like this:
2249
+ #
2250
+ # Monday: 1
2251
+ # Tuesday: 2
2252
+ # Wednesday: 3
2253
+ # Thursday: 4
2254
+ # Friday: 5
2255
+ # Saturday: 6
2256
+ # Sunday: 0
2257
+ #
2258
+ # So, how to calculate the time difference to the next day?
2259
+ #
2260
+ # Well, say we have the current day be a Wednesday, and the day that is
2261
+ # to be compared, a Friday. The difference is thus (5 - 3 = 2). If the
2262
+ # current day is a Saturday, and the input-day is a Friday, then
2263
+ # the difference must be 5.
2264
+ #
2265
+ # If we have, for example, "Friday" to "Tuesday", the this method
2266
+ # should return the number 4, because the distance is that: Friday,
2267
+ # Saturday, Sunday and Monday (the start day has to be included, as
2268
+ # lectures can happen on that day still, e. g. if you check early
2269
+ # in the morning, you could still have courses in the evening
2270
+ # slots scheduled).
2271
+ # ========================================================================= #
2272
+ def n_days_difference_from_today_to_this_day(
2273
+ time_now = Time.now,
2274
+ name_of_the_future_day # ← This ought to be a String, such as "Monday".
2275
+ )
2276
+ n_days_difference = 0
2277
+ weekday_as_number = time_now.wday
2278
+ name_of_the_future_day = name_of_the_future_day.dup if name_of_the_future_day.frozen?
2279
+ name_of_the_future_day.strip! # We better strip that input.
2280
+ start_day = Date::DAYNAMES[weekday_as_number]
2281
+ # ======================================================================= #
2282
+ # The next is simply a hardcoded table. We will begin with the
2283
+ # future day.
2284
+ # ======================================================================= #
2285
+ n_days_difference =
2286
+ case start_day
2287
+ when 'Monday'
2288
+ case name_of_the_future_day
2289
+ when 'Tuesday' then 1
2290
+ when 'Wednesday' then 2
2291
+ when 'Thursday' then 3
2292
+ when 'Friday' then 4
2293
+ when 'Saturday' then 5
2294
+ when 'Sunday' then 6
2295
+ end
2296
+ when 'Tuesday'
2297
+ case name_of_the_future_day
2298
+ when 'Wednesday' then 1
2299
+ when 'Thursday' then 2
2300
+ when 'Friday' then 3
2301
+ when 'Saturday' then 4
2302
+ when 'Sunday' then 5
2303
+ when 'Monday' then 6
2304
+ end
2305
+ when 'Wednesday'
2306
+ case name_of_the_future_day
2307
+ when 'Thursday' then 1
2308
+ when 'Friday' then 2
2309
+ when 'Saturday' then 3
2310
+ when 'Sunday' then 4
2311
+ when 'Monday' then 5
2312
+ when 'Tuesday' then 6
2313
+ end
2314
+ when 'Thursday'
2315
+ case name_of_the_future_day
2316
+ when 'Friday' then 1
2317
+ when 'Saturday' then 2
2318
+ when 'Sunday' then 3
2319
+ when 'Monday' then 4
2320
+ when 'Tuesday' then 5
2321
+ when 'Wednesday' then 6
2322
+ end
2323
+ when 'Friday'
2324
+ case name_of_the_future_day
2325
+ when 'Saturday' then 1
2326
+ when 'Sunday' then 2
2327
+ when 'Monday' then 3
2328
+ when 'Tuesday' then 4
2329
+ when 'Wednesday' then 5
2330
+ when 'Thursday' then 6
2331
+ end
2332
+ when 'Saturday'
2333
+ case name_of_the_future_day
2334
+ when 'Sunday' then 1
2335
+ when 'Monday' then 2
2336
+ when 'Tuesday' then 3
2337
+ when 'Wednesday' then 4
2338
+ when 'Thursday' then 5
2339
+ when 'Friday' then 6
2340
+ end
2341
+ when 'Sunday'
2342
+ case name_of_the_future_day
2343
+ when 'Monday' then 1
2344
+ when 'Tuesday' then 2
2345
+ when 'Wednesday' then 3
2346
+ when 'Thursday' then 4
2347
+ when 'Friday' then 5
2348
+ when 'Saturday' then 6
2349
+ end
2350
+ end
2351
+ return n_days_difference
2352
+ end
2353
+
2354
+ # ========================================================================= #
2355
+ # === return_current_year
2356
+ #
2357
+ # This method will simply return the current year, as String.
2358
+ # ========================================================================= #
2359
+ def return_current_year
2360
+ Time.now.year.to_s
2361
+ end; alias current_year? return_current_year # === current_year?
2362
+
2363
+ # ========================================================================= #
2364
+ # === return_lva_number_of_this_lecture
2365
+ # ========================================================================= #
2366
+ def return_lva_number_of_this_lecture(this_lecture)
2367
+ ::Studium.return_lva_number_of_this_lecture(this_lecture)
2368
+ end
2369
+
2370
+ # ========================================================================= #
2371
+ # === csv_file?
2372
+ # ========================================================================= #
2373
+ def csv_file?
2374
+ FILE_PASSED_EXAMS_PER_MONTH
2375
+ end
2376
+
2377
+ # ========================================================================= #
2378
+ # === do_these_curricula_include_both_a_bachelor_and_a_master_curriculum?(i)
2379
+ #
2380
+ # The input to this method should be an Array.
2381
+ # ========================================================================= #
2382
+ def do_these_curricula_include_both_a_bachelor_and_a_master_curriculum?(i)
2383
+ result = false
2384
+ if i.any? {|entry| entry.start_with?('033')} and
2385
+ i.any? {|entry| entry.start_with?('066')}
2386
+ result = true
2387
+ end
2388
+ return result
2389
+ end
2390
+
2391
+ # ========================================================================= #
2392
+ # === from_curriculum_id_to_university
2393
+ #
2394
+ # This method will translate from the curriculum-ID to the university.
2395
+ # So it will return a String such as "BOKU".
2396
+ # ========================================================================= #
2397
+ def from_curriculum_id_to_university(id)
2398
+ ::Studium.from_curriculum_id_to_university(id)
2399
+ end; alias from_curriculum_number_to_university from_curriculum_id_to_university # === from_curriculum_number_to_university
2400
+ alias which_university? from_curriculum_id_to_university # === which_university?
2401
+
2402
+ # ========================================================================= #
2403
+ # === return_name_of_this_curriculum_based_on_its_id_number
2404
+ #
2405
+ # The input to this method should be the ID of a curriculum number,
2406
+ # ideally as a String, such as '033290'.
2407
+ # ========================================================================= #
2408
+ def return_name_of_this_curriculum_based_on_its_id_number(i)
2409
+ ::Studium.map_curriculum_number_to_curriculum_name(i)
2410
+ end; alias from_curriculum_id_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === from_curriculum_id_to_curriculum_name
2411
+ alias return_curriculum_name_of_this_curriculum_number return_name_of_this_curriculum_based_on_its_id_number # === return_curriculum_name_of_this_curriculum_number
2412
+ alias curriculum_number_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === curriculum_number_to_curriculum_name
2413
+ alias name_of_this_curriculum? return_name_of_this_curriculum_based_on_its_id_number # === name_of_this_curriculum?
2414
+ alias return_name_of_the_curriculum_based_on_this_curriculum_id return_name_of_this_curriculum_based_on_its_id_number # === return_name_of_the_curriculum_based_on_this_curriculum_id
2415
+ alias return_name_of_the_curriculum return_name_of_this_curriculum_based_on_its_id_number # === return_name_of_the_curriculum
2416
+ alias turn_id_to_curriculum_name return_name_of_this_curriculum_based_on_its_id_number # === turn_id_to_curriculum_name
2417
+
2418
+ # ========================================================================= #
2419
+ # === return_all_bachelor_lectures
2420
+ #
2421
+ # This method will simply return all bachelor-lectures.
2422
+ # ========================================================================= #
2423
+ def return_all_bachelor_lectures(
2424
+ from_this_dataset = ::Studium.main_dataset?
2425
+ )
2426
+ if from_this_dataset.nil?
2427
+ ::Studium.initialize_main_dataset
2428
+ from_this_dataset = ::Studium.main_dataset?
2429
+ end
2430
+ from_this_dataset.select {|name_of_the_lecture, inner_hash|
2431
+ array = inner_hash['curricula']
2432
+ is_a_bachelor_lecture?(array)
2433
+ }
2434
+ end
2435
+
2436
+ # ========================================================================= #
2437
+ # === return_either_grey_or_the_custom_colour_for_answers
2438
+ # ========================================================================= #
2439
+ def return_either_grey_or_the_custom_colour_for_answers
2440
+ _ = grey('').strip
2441
+ if @custom_colours and
2442
+ @custom_colours.has_key?('colour_for_answers')
2443
+ _ = COLOURS.send(@custom_colours['colour_for_answers']) { :omit_end }
2444
+ end
2445
+ _
2446
+ end
2447
+
2448
+ # ========================================================================= #
2449
+ # === bachelor_master_or_diploma
2450
+ #
2451
+ # For a given solved lecture, we will determine whether it belongs
2452
+ # to a Bachelor (B), Master (M) or Diploma (D) curriculum.
2453
+ #
2454
+ # For the line:
2455
+ #
2456
+ # 13.05.2020 | 1.0 | 1.0 | 1 | BOKU | M | SE | 940003 | 2020S | Emerging Topics in RNA Biology (in Eng.)
2457
+ # 0 1 2 3 4 5
2458
+ #
2459
+ # It would be at 5.
2460
+ # ========================================================================= #
2461
+ def bachelor_master_or_diploma(
2462
+ this_lecture, dataset = nil
2463
+ )
2464
+ if dataset.nil? and File.exist? FILE_PASSED_EXAMS_PER_MONTH
2465
+ dataset = File.readlines(FILE_PASSED_EXAMS_PER_MONTH).reject {|line|
2466
+ line.strip.empty? or
2467
+ line.strip.start_with?('#')
2468
+ }
2469
+ end
2470
+ selection = dataset.select {|line|
2471
+ splitted = this_lecture.split(' ')
2472
+ lecture_id = splitted.first
2473
+ course_name = splitted[1..-1].join(' ').strip
2474
+ line.include?(lecture_id) and
2475
+ line.include?(course_name)
2476
+ }
2477
+ if selection.empty?
2478
+ '(unknown)'
2479
+ else
2480
+ selection = selection.first
2481
+ return selection.split('|')[5].strip
2482
+ end
2483
+ end
2484
+
2485
+ # ========================================================================= #
2486
+ # === is_a_master_lecture?
2487
+ # ========================================================================= #
2488
+ def is_a_master_lecture?(i)
2489
+ Studium.is_a_master_lecture?(i)
2490
+ end
2491
+
2492
+ # ========================================================================= #
2493
+ # === read_dataset_from_a_curriculum_file
2494
+ # ========================================================================= #
2495
+ def read_dataset_from_a_curriculum_file(
2496
+ i,
2497
+ optional_commands = :remove_comments
2498
+ )
2499
+ Studium.read_dataset_from_a_curriculum_file(i, optional_commands)
2500
+ end
2501
+
2502
+ # ========================================================================= #
2503
+ # === return_name_of_this_curriculum
2504
+ #
2505
+ # This method will return the official name of a curriculum. In order
2506
+ # to achieve this, the method will read the file, and grab the second
2507
+ # line, which should contain the name of the curriculum at hand.
2508
+ #
2509
+ # This method will NOT remove strings such as "Bachelorcurriculum"
2510
+ # or "Mastercurriculum", due to the individual vector-curriculum
2511
+ # having the very same name (Bachelor + Master).
2512
+ # ========================================================================= #
2513
+ def return_name_of_this_curriculum(i)
2514
+ file = return_file_for_this_curriculum(i)
2515
+ if file.nil?
2516
+ e 'Something went wrong for the input '+steelblue(i)+'.'
2517
+ e 'No match could be found for it. Are you sure that it must exist?'
2518
+ exit
2519
+ elsif File.exist? file
2520
+ dataset = readlines_with_proper_encoding(file)
2521
+ name = dataset[1].delete('#=').strip
2522
+ return name
2523
+ end
2524
+ end; alias return_long_name_of_this_curriculum return_name_of_this_curriculum # === return_long_name_of_this_curriculum
2525
+
2526
+ # ========================================================================= #
2527
+ # === rds
2528
+ # ========================================================================= #
2529
+ def rds(i)
2530
+ i.squeeze('/')
2531
+ end
2532
+
2533
+ # ========================================================================= #
2534
+ # === return_all_registered_curricula
2535
+ # ========================================================================= #
2536
+ def return_all_registered_curricula
2537
+ Studium.return_registered_standalone_curricula
2538
+ end
2539
+
2540
+ # ========================================================================= #
2541
+ # === return_dataset_from_this_curriculum_file
2542
+ # ========================================================================= #
2543
+ def return_dataset_from_this_curriculum_file(i)
2544
+ return Studium.return_dataset_from_this_curriculum_file(i)
2545
+ end; alias return_dataset_for_this_curriculum_file return_dataset_from_this_curriculum_file # === return_dataset_for_this_curriculum_file
2546
+ alias return_dataset_from_this_curriculum return_dataset_from_this_curriculum_file # === return_dataset_from_this_curriculum
2547
+ alias return_this_curriculum return_dataset_from_this_curriculum_file # === return_this_curriculum
2548
+
2549
+ # ========================================================================= #
2550
+ # === ensure_that_the_log_directory_exists
2551
+ #
2552
+ # This method will try to make sure that the log directory exists.
2553
+ # ========================================================================= #
2554
+ def ensure_that_the_log_directory_exists
2555
+ _ = log_dir?
2556
+ unless File.directory? _
2557
+ mkdir(_)
2558
+ end
2559
+ unless File.directory? _+'html/'
2560
+ mkdir(_+'html/')
2561
+ end
2562
+ end
2563
+
2564
+ # ========================================================================= #
2565
+ # === has_a_bachelor_curriculum?
2566
+ #
2567
+ # This method will return true if the given Array has any bachelor
2568
+ # curriculum; and it will return false otherwise.
2569
+ # ========================================================================= #
2570
+ def has_a_bachelor_curriculum?(array)
2571
+ Studium.has_a_bachelor_curriculum?(array)
2572
+ end; alias is_a_bachelor_lecture? has_a_bachelor_curriculum? # === is_a_bachelor_curriculum?
2573
+ alias has_a_bachelor_curriculum_entry? has_a_bachelor_curriculum? # === has_a_bachelor_curriculum_entry?
2574
+ alias is_a_bachelor_curriculum? has_a_bachelor_curriculum? # === is_a_bachelor_curriculum?
2575
+ alias does_this_include_a_bachelor_curriculum? has_a_bachelor_curriculum? # === does_this_include_a_bachelor_curriculum?
2576
+
2577
+ # ========================================================================= #
2578
+ # === has_a_master_curriculum?
2579
+ #
2580
+ # This method will return true if the given Array has any master
2581
+ # curriculum; and it will return false otherwise.
2582
+ #
2583
+ # Note that there is an alias called
2584
+ # "is_this_lecture_registered_in_a_master_curriculum?". The name is a
2585
+ # of a misnomer, since the input to this method should be an Array
2586
+ # containing the IDs of the Curricula for which that lecture is
2587
+ # registered. This may be subject for change one day, but for
2588
+ # now (Sep 2018) we will keep it that way.
2589
+ # ========================================================================= #
2590
+ def has_a_master_curriculum?(array)
2591
+ Studium.has_a_master_curriculum?(array)
2592
+ end; alias is_a_master_curriculum? has_a_master_curriculum? # === is_a_master_curriculum?
2593
+ alias has_a_master_lecture? has_a_master_curriculum? # === has_a_master_lecture?
2594
+ alias has_a_master_curriculum_entry? has_a_master_curriculum? # === has_a_master_curriculum_entry?
2595
+ alias is_this_lecture_registered_in_a_master_curriculum? has_a_master_curriculum? # === is_this_lecture_registered_in_a_master_curriculum?
2596
+ alias does_this_include_a_master_curriculum? has_a_master_curriculum? # === does_this_include_a_master_curriculum?
2597
+
2598
+ # ========================================================================= #
2599
+ # === has_a_bachelor_and_a_master_curriculum?
2600
+ # ========================================================================= #
2601
+ def has_a_bachelor_and_a_master_curriculum?(i)
2602
+ has_a_bachelor_curriculum?(i) and has_a_master_curriculum?(i)
2603
+ end
2604
+
2605
+ # ========================================================================= #
2606
+ # === obtain_lectures_from_this_curriculum
2607
+ #
2608
+ # This method should be used whenever you wish to obtain all lectures
2609
+ # that belong to a specific curriculum, without any comments.
2610
+ #
2611
+ # An Array will be returned by this method.
2612
+ # ========================================================================= #
2613
+ def obtain_lectures_from_this_curriculum(
2614
+ i = :default,
2615
+ do_flatten_the_result = true
2616
+ )
2617
+ Studium.read_dataset_from_a_curriculum_file(i, :remove_comments, do_flatten_the_result).map {|entry|
2618
+ entry.squeeze(' ') # ← We don't want multiple ' ' in succession here.
2619
+ }
2620
+ end; alias return_lectures_from_this_curriculum obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculum
2621
+ alias return_lectures_of_this_curriculum obtain_lectures_from_this_curriculum # === return_lectures_of_this_curriculum
2622
+ alias return_lectures_from_this_curriculu obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculu
2623
+ alias return_lectures_from_this_curriculum_file obtain_lectures_from_this_curriculum # === return_lectures_from_this_curriculum_file
2624
+
2625
+ # ========================================================================= #
2626
+ # === available_topics_as_short_name
2627
+ # ========================================================================= #
2628
+ def available_topics_as_short_name
2629
+ ::Studium::Exams.all_topics_as_short_name.sort
2630
+ end; alias available_topics? available_topics_as_short_name # === available_topics?
2631
+ alias exam_topics? available_topics_as_short_name # === exam_topics?
2632
+ alias return_all_exam_topics available_topics_as_short_name # === return_all_exam_topics
2633
+ alias available_exam_topics? available_topics_as_short_name # === available_exam_topics?
2634
+
2635
+ # ========================================================================= #
2636
+ # === find_corresponding_exam_topic
2637
+ #
2638
+ # This method will find the corresponding exam topic, based on a short
2639
+ # input. For example, "bem1" will be short for basic biochemistry.
2640
+ # ========================================================================= #
2641
+ def find_corresponding_exam_topic(i)
2642
+ Studium.find_corresponding_exam_topic(i)
2643
+ end; alias return_file_associated_with_this_exam_topic find_corresponding_exam_topic # === return_file_associated_with_this_exam_topic
2644
+
2645
+ # ========================================================================= #
2646
+ # === return_n_exam_questions_in
2647
+ #
2648
+ # This method will return how many exam questions are in the given topic
2649
+ # xyz.
2650
+ # ========================================================================= #
2651
+ def return_n_exam_questions_in(this_topic)
2652
+ Studium::Exams.return_n_questions_in_this_topic(this_topic)
2653
+ end
2654
+
2655
+ # ========================================================================= #
2656
+ # === file_lecture_information?
2657
+ # ========================================================================= #
2658
+ def file_lecture_information?
2659
+ ::Studium.file_lecture_information?
2660
+ end
2661
+
2662
+ # ========================================================================= #
2663
+ # === infer_the_namespace
2664
+ #
2665
+ # This will assume the true namespace from the inspectable name.
2666
+ # ========================================================================= #
2667
+ def infer_the_namespace
2668
+ _ = inspect.to_s.delete('<')
2669
+ if _.include? ' '
2670
+ _ = _.split(' ').first.delete('#')
2671
+ if _.include? ':'
2672
+ _ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
2673
+ end
2674
+ end
2675
+ @namespace = _ # And assign it here.
2676
+ end
2677
+
2678
+ # ========================================================================= #
2679
+ # === left_arrow
2680
+ # ========================================================================= #
2681
+ def left_arrow?
2682
+ '←'
2683
+ end; alias left_arrow left_arrow? # === left_arrow
2684
+
2685
+ # ========================================================================= #
2686
+ # === right_arrow?
2687
+ # ========================================================================= #
2688
+ def right_arrow?
2689
+ UNICODE_RIGHT_ARROW
2690
+ end; alias right_arrow right_arrow? # === right_arrow
2691
+
2692
+ end; end
2693
+
2694
+ if __FILE__ == $PROGRAM_NAME
2695
+ require 'verbose_truth'
2696
+ alias e puts
2697
+ x = Studium::Base.new
2698
+ e x.this_month_has_n_days?('10')
2699
+ e x.this_month_has_n_days?('11')
2700
+ e x.this_month_has_n_days?('12')
2701
+ e 'Do we have konsole support? '+
2702
+ VerboseTruth[
2703
+ x.konsole_support?.to_s
2704
+ ]
2705
+ p x.web_liner
2706
+ Studium::Base.new.directory_to_the_exam_topics?
2707
+ p base.weekday?
2708
+ p base.today?
2709
+ p base.select_lectures_with_this_key(:exam_registration_at)
2710
+ end