Class: Scorm::Organization
- Inherits:
-
Object
- Object
- Scorm::Organization
- Defined in:
- lib/scorm/organization.rb
Overview
The Organization
class holds data about the organization of a SCORM package. An organization contains an id, title and any number of items
. An Item
are (in most cases) the same thing as a SCO (Shareable Content Object).
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#items ⇒ Object
Returns the value of attribute items.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, title, items) ⇒ Organization
constructor
A new instance of Organization.
Constructor Details
#initialize(id, title, items) ⇒ Organization
Returns a new instance of Organization.
19 20 21 22 23 24 |
# File 'lib/scorm/organization.rb', line 19 def initialize(id, title, items) raise InvalidManifest, 'missing organization id' if id.nil? @id = id.to_s @title = title.to_s @items = items end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/scorm/organization.rb', line 15 def id @id end |
#items ⇒ Object
Returns the value of attribute items.
17 18 19 |
# File 'lib/scorm/organization.rb', line 17 def items @items end |
#title ⇒ Object
Returns the value of attribute title.
16 17 18 |
# File 'lib/scorm/organization.rb', line 16 def title @title end |
Class Method Details
.from_xml(element) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/scorm/organization.rb', line 26 def self.from_xml(element) id = element.attribute('identifier').to_s title = element.get_elements('title').first.text.to_s if element.get_elements('title').first items = [] REXML::XPath.each(element, 'item') do |item_el| items << Item.from_xml(item_el) end return self.new(id, title, items) end |