Class: CommonCartridge::Package
- Inherits:
-
Object
- Object
- CommonCartridge::Package
- Defined in:
- lib/common_cartridge/package.rb
Instance Attribute Summary collapse
-
#assignments ⇒ Object
Returns the value of attribute assignments.
-
#manifest ⇒ Object
Returns the value of attribute manifest.
-
#outcomes ⇒ Object
Returns the value of attribute outcomes.
Instance Method Summary collapse
- #all_outcomes ⇒ Object
- #announcements ⇒ Object
- #discussions ⇒ Object
- #find_resource(identifier) ⇒ Object
-
#initialize ⇒ Package
constructor
A new instance of Package.
- #modules ⇒ Object
- #outcome_groups ⇒ Object
- #pages ⇒ Object
- #quizzes ⇒ Object
Constructor Details
#initialize ⇒ Package
Returns a new instance of Package.
5 6 7 |
# File 'lib/common_cartridge/package.rb', line 5 def initialize @assignments = [] end |
Instance Attribute Details
#assignments ⇒ Object
Returns the value of attribute assignments.
3 4 5 |
# File 'lib/common_cartridge/package.rb', line 3 def assignments @assignments end |
#manifest ⇒ Object
Returns the value of attribute manifest.
3 4 5 |
# File 'lib/common_cartridge/package.rb', line 3 def manifest @manifest end |
#outcomes ⇒ Object
Returns the value of attribute outcomes.
3 4 5 |
# File 'lib/common_cartridge/package.rb', line 3 def outcomes @outcomes end |
Instance Method Details
#all_outcomes ⇒ Object
17 18 19 |
# File 'lib/common_cartridge/package.rb', line 17 def all_outcomes @all_outcomes ||= outcome_groups.collect { |g| g.outcomes }.flatten end |
#announcements ⇒ Object
29 30 31 |
# File 'lib/common_cartridge/package.rb', line 29 def announcements @announcements ||= resources_of_type(Elements::Resources::Topic).select { |d| d.is_announcement? } end |
#discussions ⇒ Object
25 26 27 |
# File 'lib/common_cartridge/package.rb', line 25 def discussions @discussions ||= resources_of_type(Elements::Resources::Topic).reject { |d| d.is_announcement? } end |
#find_resource(identifier) ⇒ Object
9 10 11 |
# File 'lib/common_cartridge/package.rb', line 9 def find_resource(identifier) manifest.resources.find { |r| r.identifier == identifier } end |
#modules ⇒ Object
21 22 23 |
# File 'lib/common_cartridge/package.rb', line 21 def modules @modules ||= manifest.organization.root_item.items end |
#outcome_groups ⇒ Object
13 14 15 |
# File 'lib/common_cartridge/package.rb', line 13 def outcome_groups @outcome_groups ||= outcomes ? outcomes.outcome_groups : [] end |
#pages ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/common_cartridge/package.rb', line 33 def pages @pages ||= begin pages = resources_of_type(Elements::Resources::Page).each do |page| assign_title(page) end filter_pages(pages) end end |
#quizzes ⇒ Object
43 44 45 46 47 |
# File 'lib/common_cartridge/package.rb', line 43 def quizzes @quizzes ||= resources_of_type(Elements::Resources::Assessment).each do |quiz| assign_title(quiz) unless quiz.title end end |