class HRX::Directory
A directory in an HRX
archive.
Attributes
comment[R]
The comment that appeared before this directory, or `nil` if it had no preceding comment.
HRX
file contents are always encoded as UTF-8.
This string is frozen.
path[R]
The path to this file, relative to the archive's root, including the trailing `/`.
HRX
paths are always `/`-separated and always encoded as UTF-8.
This string is frozen.
Public Class Methods
new(path, comment: nil)
click to toggle source
Creates a new file with the given paths and comment.
Throws an HRX::ParseError
if `path` is invalid, or an EncodingError if either argument can't be converted to UTF-8.
The `path` may or may not end with a `/`. If it doesn't a `/` will be added.
# File lib/hrx/directory.rb, line 41 def initialize(path, comment: nil) @comment = comment&.clone&.encode("UTF-8")&.freeze @path = HRX::Util.scan_path(StringScanner.new(path.encode("UTF-8"))) @path << "/" unless @path.end_with?("/") @path.freeze end