Class: CommonCartridge::Package

Inherits:
Object
  • Object
show all
Defined in:
lib/common_cartridge/package.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePackage

Returns a new instance of Package.



5
6
7
# File 'lib/common_cartridge/package.rb', line 5

def initialize
  @assignments = []
end

Instance Attribute Details

#assignmentsObject

Returns the value of attribute assignments.



3
4
5
# File 'lib/common_cartridge/package.rb', line 3

def assignments
  @assignments
end

#manifestObject

Returns the value of attribute manifest.



3
4
5
# File 'lib/common_cartridge/package.rb', line 3

def manifest
  @manifest
end

#outcomesObject

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_outcomesObject



17
18
19
# File 'lib/common_cartridge/package.rb', line 17

def all_outcomes
  @all_outcomes ||= outcome_groups.collect { |g| g.outcomes }.flatten
end

#announcementsObject



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

#discussionsObject



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

#modulesObject



21
22
23
# File 'lib/common_cartridge/package.rb', line 21

def modules
  @modules ||= manifest.organization.root_item.items
end

#outcome_groupsObject



13
14
15
# File 'lib/common_cartridge/package.rb', line 13

def outcome_groups
  @outcome_groups ||= outcomes ? outcomes.outcome_groups : []
end

#pagesObject



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

#quizzesObject



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