Class: Lti::ThinCommonCartridge
- Inherits:
-
Object
- Object
- Lti::ThinCommonCartridge
- Defined in:
- lib/lti/thin_common_cartridge.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
- #create_nodes ⇒ Object
-
#initialize(items) ⇒ ThinCommonCartridge
constructor
A new instance of ThinCommonCartridge.
- #manifest ⇒ Object
Constructor Details
#initialize(items) ⇒ ThinCommonCartridge
Returns a new instance of ThinCommonCartridge.
10 11 12 13 14 15 16 17 |
# File 'lib/lti/thin_common_cartridge.rb', line 10 def initialize(items) @items = Array.wrap items @xml = File.open(File. MANIFEST_FILEPATH) { |f| Nokogiri::XML(f) } @link_template = File.open(File. LTI_LINK_FILEPATH) { |f| Nokogiri::XML(f) } @links = [] create_nodes end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
8 9 10 |
# File 'lib/lti/thin_common_cartridge.rb', line 8 def links @links end |
Instance Method Details
#create_nodes ⇒ Object
19 20 21 22 23 |
# File 'lib/lti/thin_common_cartridge.rb', line 19 def create_nodes # Build hierarchy of objects root_item = xml.at 'organizations/organization/item' items.each { |c| add_item c, root_item } end |
#manifest ⇒ Object
25 26 27 |
# File 'lib/lti/thin_common_cartridge.rb', line 25 def manifest xml.to_xml end |