Sha256: 9e55a9672bece59f02e9424e3d9afa0272d4c42d3c6dd264fd92f34aa2679b59

Contents?: true

Size: 461 Bytes

Versions: 6

Compression:

Stored size: 461 Bytes

Contents

module Stowaway
  class FileObj
    attr :fullpath
    
    def initialize(fullpath, root = nil)
      @fullpath = fullpath
      @root = root || Dir.pwd
    end
    
    def name
      File.basename(@fullpath)
    end
    
    def path
      File.split(@fullpath)[0]
    end

    def root_path
      root = @root.split("/").last
      @fullpath.sub(/^.+\/#{root}/, "")
    end
    
    def ==(fileObj)
      self.fullpath == fileObj.fullpath
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stowaway-0.2.0 lib/stowaway/file.rb
stowaway-0.1.10 lib/stowaway/file.rb
stowaway-0.1.9 lib/stowaway/file.rb
stowaway-0.1.8 lib/stowaway/file.rb
stowaway-0.1.6 lib/stowaway/file.rb
stowaway-0.1.5 lib/stowaway/file.rb