Sha256: fffcec11e63590d8aae6f27575d206c85522bb3b9c8935c9b31a2b4ae2356ab4

Contents?: true

Size: 617 Bytes

Versions: 1

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

module BrowseEverything
  class FileEntry
    attr_reader :id, :location, :name, :size, :mtime, :type

    def initialize(id, location, name, size, mtime, container, type = nil)
      @id        = id
      @location  = location
      @name      = name
      @size      = size
      @mtime     = mtime
      @container = container
      @type      = type || (@container ? 'application/x-directory' : Rack::Mime.mime_type(File.extname(name)))
    end

    def relative_parent_path?
      /^\.\.?$/.match(name) ? true : false
    end

    def container?
      @container
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
browse-everything-0.16.0 lib/browse_everything/file_entry.rb