class CommonCartridge::Elements::Resources::Resource

Attributes

points_possible[W]
question_count[RW]
title[W]

Public Instance Methods

file_locations() click to toggle source
# File lib/common_cartridge/elements/resources.rb, line 96
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?() click to toggle source
# File lib/common_cartridge/elements/resources.rb, line 105
def is_announcement?
  !!dependencies.collect(&:contents).flatten.detect { |c| c.type == 'announcement' }
end
points_possible() click to toggle source

Switch statement based on 'type'

# File lib/common_cartridge/elements/resources.rb, line 82
def points_possible
  @points_possible ||= if dependency = dependencies.detect { |d| d.points_possible && !d.points_possible.empty? }
    dependency.points_possible
  end
end
title() click to toggle source
# File lib/common_cartridge/elements/resources.rb, line 88
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