Method: Arrow::Path#valid_dirs

Defined in:
lib/arrow/path.rb

#valid_dirsObject

Fetch the list of valid directories, using a cached value if the path has caching enabled (which is the default). Otherwise, it fetches the valid list via #find_valid_dirs and caches the result for #cache_lifespan seconds. If caching is disabled, this is equivalent to just calling #find_valid_dirs.



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/arrow/path.rb', line 119

def valid_dirs
  if ( @cache_lifespan.nonzero? &&
     ((Time.now - @last_stat) < @cache_lifespan) )
    self.log.debug "Returning cached dirs."
    return @valid_dirs
  end

  @valid_dirs = self.find_valid_dirs
  @last_stat = Time.now

  return @valid_dirs
end