module Scorm2004::Manifest::XmlBase
Public Instance Methods
base()
click to toggle source
# File lib/scorm2004/manifest/xml_base.rb, line 7 def base normalize_path(parent_base ? resolve_base : relative_base) end
Private Instance Methods
normalize_path(path)
click to toggle source
# File lib/scorm2004/manifest/xml_base.rb, line 33 def normalize_path(path) path.is_a?(Pathname) ? (Pathname('/') + path).relative_path_from(Pathname('/')) : path end
parent_base()
click to toggle source
# File lib/scorm2004/manifest/xml_base.rb, line 21 def parent_base @options[:base] end
relative_base()
click to toggle source
# File lib/scorm2004/manifest/xml_base.rb, line 13 def relative_base value = @el.at('./@xml:base', NS) return unless value error("Invalid XML Base value: #{value}") if %r!^/|[^/]$! =~ value uri = URI(value) uri.absolute? ? uri : Pathname(uri.path) end
resolve_base()
click to toggle source
# File lib/scorm2004/manifest/xml_base.rb, line 25 def resolve_base if relative_base.is_a?(URI) relative_base else parent_base + relative_base.to_s end end