The resource manager, providing ordered access to Container objects.
Public class methods
new
()
[show source]
# File lib/nwn/res.rb, line 129 def initialize @path = [] @_content_cache = nil end
Public instance methods
content
()
Get a list of filenames contained inside.
[show source]
# File lib/nwn/res.rb, line 155 def content @_content_cache ||= @path.inject([]) {|a, x| a |= x.filenames } end
get
(filename)
Get the contents of the given filename. Raises ENOENT if not mapped.
[show source]
# File lib/nwn/res.rb, line 150 def get filename get_content_object(filename).get end
get_content_object
(filename)
Get the ContentObject pointing to the given filename. Raises ENOENT if not mapped.
[show source]
# File lib/nwn/res.rb, line 140 def get_content_object filename @path.reverse.each {|con| con.has?(filename) or next return con.get_content_object(filename) } raise Errno::ENOENT, "No ContentObject with the given filename #{filename.inspect} found." end