Class: Moodle2CC::CanvasCC::Models::Course
- Inherits:
-
Object
- Object
- Moodle2CC::CanvasCC::Models::Course
- Defined in:
- lib/moodle2cc/canvas_cc/models/course.rb
Instance Attribute Summary collapse
-
#assessments ⇒ Object
Returns the value of attribute assessments.
-
#assignments ⇒ Object
Returns the value of attribute assignments.
-
#canvas_modules ⇒ Object
Returns the value of attribute canvas_modules.
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#discussions ⇒ Object
Returns the value of attribute discussions.
-
#files ⇒ Object
Returns the value of attribute files.
-
#format ⇒ Object
Returns the value of attribute format.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#question_banks ⇒ Object
Returns the value of attribute question_banks.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #all_resources ⇒ Object
- #conclude_at ⇒ Object
-
#initialize ⇒ Course
constructor
A new instance of Course.
- #method_missing(m, *args, &block) ⇒ Object
- #mute_assignments! ⇒ Object
- #resolve_question_references! ⇒ Object
- #start_at ⇒ Object
Constructor Details
#initialize ⇒ Course
Returns a new instance of Course.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 7 def initialize @settings = {} @resources = [] @canvas_modules = [] @files = [] @pages = [] @discussions = [] @assignments = [] @assessments = [] @question_banks = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 32 def method_missing(m, *args, &block) method = m.to_s if method[-1, 1] == '=' method.chomp!('=') @settings[method.to_sym] = args.first end @settings[method.to_sym] end |
Instance Attribute Details
#assessments ⇒ Object
Returns the value of attribute assessments.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def assessments @assessments end |
#assignments ⇒ Object
Returns the value of attribute assignments.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def assignments @assignments end |
#canvas_modules ⇒ Object
Returns the value of attribute canvas_modules.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def canvas_modules @canvas_modules end |
#copyright ⇒ Object
Returns the value of attribute copyright.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def copyright @copyright end |
#discussions ⇒ Object
Returns the value of attribute discussions.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def discussions @discussions end |
#files ⇒ Object
Returns the value of attribute files.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def files @files end |
#format ⇒ Object
Returns the value of attribute format.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def format @format end |
#identifier ⇒ Object
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def identifier @identifier end |
#pages ⇒ Object
Returns the value of attribute pages.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def pages @pages end |
#question_banks ⇒ Object
Returns the value of attribute question_banks.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def question_banks @question_banks end |
#resources ⇒ Object
Returns the value of attribute resources.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def resources @resources end |
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 4 def settings @settings end |
Instance Method Details
#all_resources ⇒ Object
28 29 30 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 28 def all_resources @resources + @files + @pages + @discussions.map(&:resources).flatten + @assignments.map(&:resources).flatten + @assessments.map(&:resources).flatten end |
#conclude_at ⇒ Object
24 25 26 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 24 def conclude_at Moodle2CC::CC::CCHelper.ims_datetime(@settings[:conclude_at]) if @settings[:conclude_at] end |
#mute_assignments! ⇒ Object
46 47 48 49 50 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 46 def mute_assignments! @assignments.each do |assignment| assignment.muted = true end end |
#resolve_question_references! ⇒ Object
41 42 43 44 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 41 def resolve_question_references! return unless @assessments && @question_banks @assessments.each{|a| a.resolve_question_references!(@question_banks)} end |
#start_at ⇒ Object
19 20 21 |
# File 'lib/moodle2cc/canvas_cc/models/course.rb', line 19 def start_at Moodle2CC::CC::CCHelper.ims_datetime(@settings[:start_at]) if @settings[:start_at] end |