Method: Arrow::Path#initialize
- Defined in:
- lib/arrow/path.rb
#initialize(path = [], cache_lifespan = DEFAULT_CACHE_LIFESPAN) ⇒ Path
Create a new Arrow::Path object for the specified path, which can be either a String containing directory names separated by File::PATH_SEPARATOR, an Array of directory names, or an object which returns such an Array when #to_a is called on it. If cache_lifespan is non-zero, the Array of valid directories will be cached for cache_lifespan seconds to save calls to stat().
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/arrow/path.rb', line 83 def initialize( path=[], cache_lifespan=DEFAULT_CACHE_LIFESPAN ) @dirs = case path when Array path.flatten when String path.split(SEPARATOR) else path.to_a.flatten end @dirs.collect! {|dir| dir.untaint.to_s } @valid_dirs = [] @cache_lifespan = cache_lifespan @last_stat = Time.at(0) end |