Sha256: 2bf582a6cfc729cf884d07fce12e8bb9d18e34f6304a4ba87ff0814081cff9f7

Contents?: true

Size: 603 Bytes

Versions: 6

Compression:

Stored size: 603 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?
      name.match?(/^\.\.?$/)
    end

    def container?
      @container
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browse-everything-1.5.0 lib/browse_everything/file_entry.rb
browse-everything-1.4.0 lib/browse_everything/file_entry.rb
browse-everything-1.3.0 lib/browse_everything/file_entry.rb
browse-everything-1.2.0 lib/browse_everything/file_entry.rb
browse-everything-1.1.2 lib/browse_everything/file_entry.rb
browse-everything-1.1.1 lib/browse_everything/file_entry.rb