class CVEList::Directory
Represents a directory within the {Repository}.
Attributes
path[R]
The path to the directory.
@return [String]
Public Class Methods
new(path)
click to toggle source
Initializes the directory.
@param [String] path
The path to the directory.
# File lib/cvelist/directory.rb, line 18 def initialize(path) @path = File.expand_path(path) end
Public Instance Methods
directory?(name)
click to toggle source
Determines whether the directory has the given directory.
@param [String] name
@return [Boolean]
# File lib/cvelist/directory.rb, line 52 def directory?(name) File.directory?(join(name)) end
file?(name)
click to toggle source
Determines whether the directory has the givne file.
@param [String] name
@return [Boolean]
# File lib/cvelist/directory.rb, line 41 def file?(name) File.file?(join(name)) end
glob(pattern)
click to toggle source
Finds all files and directories matching the pattern.
@param [String] pattern
The glob pattern.
@return [Array<String>]
The matching file and directory paths.
# File lib/cvelist/directory.rb, line 65 def glob(pattern) Dir[join(pattern)] end
join(*names)
click to toggle source
Joins the file/directory name(s) with the directory path.
@param [Array<String>] names
The file/directory name(s).
@return [String]
# File lib/cvelist/directory.rb, line 30 def join(*names) File.join(@path,*names) end
to_s()
click to toggle source
Converts the directory to a String.
@return [String]
The path to the directory.
# File lib/cvelist/directory.rb, line 75 def to_s @path end