Class: CommonCartridge::Elements::Resources::Resource
- Inherits:
-
Object
- Object
- CommonCartridge::Elements::Resources::Resource
- Includes:
- SAXMachine
- Defined in:
- lib/common_cartridge/elements/resources.rb
Instance Attribute Summary collapse
-
#points_possible ⇒ Object
Switch statement based on ‘type’.
-
#question_count ⇒ Object
Returns the value of attribute question_count.
- #title ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#points_possible ⇒ Object
Switch statement based on ‘type’
81 82 83 84 85 |
# File 'lib/common_cartridge/elements/resources.rb', line 81 def points_possible @points_possible ||= if dependency = dependencies.detect { |d| d.points_possible && !d.points_possible.empty? } dependency.points_possible end end |
#question_count ⇒ Object
Returns the value of attribute question_count.
67 68 69 |
# File 'lib/common_cartridge/elements/resources.rb', line 67 def question_count @question_count end |
#title ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/common_cartridge/elements/resources.rb', line 87 def title @title ||= if file = files.detect { |f| f.content && f.content.title && !f.content.title.empty? } file.content.title elsif dependency = dependencies.detect { |d| d.title && !d.title.empty? } dependency.title end end |
Instance Method Details
#file_locations ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/common_cartridge/elements/resources.rb', line 95 def file_locations [ ::File.join(identifier, "assessment.xml"), ::File.join(identifier, "assessment_qti.xml"), ::File.join("non_cc_assessments", "#{identifier}.xml"), ::File.join("non_cc_assessments", "#{identifier}.xml.qti") ] end |
#is_announcement? ⇒ Boolean
104 105 106 |
# File 'lib/common_cartridge/elements/resources.rb', line 104 def is_announcement? !!dependencies.collect(&:contents).flatten.detect { |c| c.type == 'announcement' } end |