Sha256: b95bd5ed80a9948bc3fa5f503a0cef8aaa8be4842c6737cc46acac5e7118a09b
Contents?: true
Size: 678 Bytes
Versions: 1
Compression:
Stored size: 678 Bytes
Contents
require 'pathname' class Pathname def components return to_s.split(SEPARATOR_PAT) end def normalize_trailing_slash if to_s.match(/\/$/) return self else return self.class.new(to_s + "/") end end end module LSync class Directory def initialize(config) @path = Pathname.new(config["path"]).cleanpath.normalize_trailing_slash abort "Directory paths must be relative (#{config["path"]} is absolute!)." if @path.absolute? end attr :path def to_s @path.to_s end # Special exception for root path def depth return @path.to_s.scan("/").size - 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lsync-1.2.1 | lib/lsync/directory.rb |