Sha256: 1d73cad87ccdda3a3273fe1cefe85ee83dfa67db6fa45d51110b4b83a1e6eaa3

Contents?: true

Size: 613 Bytes

Versions: 7

Compression:

Stored size: 613 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 =~ /^\.\.?$/ ? true : false
    end

    def container?
      @container
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
browse-everything-1.1.0 lib/browse_everything/file_entry.rb
browse-everything-1.0.2 lib/browse_everything/file_entry.rb
browse-everything-1.0.1 lib/browse_everything/file_entry.rb
browse-everything-1.0.0 lib/browse_everything/file_entry.rb
browse-everything-1.0.0.rc2 lib/browse_everything/file_entry.rb
browse-everything-1.0.0.rc1 lib/browse_everything/file_entry.rb
browse-everything-0.16.1 lib/browse_everything/file_entry.rb