This is a simple 2da cache.
Public class methods
get
(name)
Get the 2da file with the given name. name is without extension. This being a cache, modifications to the returned Table will be reflected in further calls to Cache.get.
[show source]
# File lib/nwn/twoda.rb, line 321 321: def self.get(name) 322: raise Exception, 323: "You need to set up the cache first through the environment variable NWN_LIB_2DA_LOCATION." unless 324: @_roots.size > 0 325: @_cache[name.downcase] ||= read_2da(name.downcase) 326: end
setup
(root_directories)
Set the file system path spec where all 2da files reside. Call this on application startup. path spec is a colon-separated list of paths, just like $PATH.
[show source]
# File lib/nwn/twoda.rb, line 314 314: def self.setup root_directories 315: @_roots = root_directories.split(':').compact.reject {|x| "" == x.strip } 316: end