Class: NWN::Resources::DirectoryContainer

Inherits:
Container
  • Object
show all
Defined in:
lib/nwn/res.rb

Overview

A Container that directly wraps a directory (e.g. override/). Does not update on changes - caches the directory entries on initialize.

Instance Attribute Summary

Attributes inherited from Container

#content

Instance Method Summary collapse

Methods inherited from Container

#add, #add_file, #filenames, #get, #get_content_object, #has?

Constructor Details

#initialize(path) ⇒ DirectoryContainer

Returns a new instance of DirectoryContainer.



115
116
117
118
119
120
121
122
123
124
# File 'lib/nwn/res.rb', line 115

def initialize path
  super()
  @path = path
  Dir[path + File::SEPARATOR + "*.*"].each {|x|
    begin add_file x
    rescue ArgumentError => e
      NWN.log_debug e.to_s
    end
  }
end