Class: Mutiny::Mutants::Storage::Path
- Inherits:
-
Object
- Object
- Mutiny::Mutants::Storage::Path
- Defined in:
- lib/mutiny/mutants/storage/path.rb
Instance Attribute Summary collapse
-
#relative ⇒ Object
readonly
Returns the value of attribute relative.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#relative ⇒ Object (readonly)
Returns the value of attribute relative.
16 17 18 |
# File 'lib/mutiny/mutants/storage/path.rb', line 16 def relative @relative end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
16 17 18 |
# File 'lib/mutiny/mutants/storage/path.rb', line 16 def root @root end |
Class Method Details
.from_absolute(path:, root:) ⇒ Object
7 8 9 10 |
# File 'lib/mutiny/mutants/storage/path.rb', line 7 def self.from_absolute(path:, root:) relative_path = Pathname.new(path).relative_path_from(Pathname.new(root)).to_s new(relative_path, root) end |
.from_relative(path:, root:) ⇒ Object
12 13 14 |
# File 'lib/mutiny/mutants/storage/path.rb', line 12 def self.from_relative(path:, root:) new(path, root) end |
Instance Method Details
#absolute ⇒ Object
18 19 20 |
# File 'lib/mutiny/mutants/storage/path.rb', line 18 def absolute File.join(root, relative) end |