Sha256: d3907e34d84eefc9c1f44e8c40161a5baeb9146b543d00a341ef3276552f70e0

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

class Servel::Path
  attr_reader :type, :media_type, :listing_classes, :icon, :href, :name, :size, :mtime

  def initialize(type:, media_type: nil, listing_classes:, icon:, href:, name:, size: nil, mtime: nil)
    @type = type
    @media_type = media_type
    @listing_classes = listing_classes
    @icon = icon
    @href = href
    @name = name
    @size = size
    @mtime = mtime
  end

  def media?
    !@media_type.nil?
  end

  def self.top(href)
    Servel::Path.new(
      type: "Dir",
      listing_classes: "top directory",
      icon: "🔝",
      href: href,
      name: "Top Directory"
    )
  end

  def self.parent(href)
    Servel::Path.new(
      type: "Dir",
      listing_classes: "parent directory",
      icon: "⬆️",
      href: href,
      name: "Parent Directory"
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
servel-0.9.0 lib/servel/path.rb
servel-0.7.0 lib/servel/path.rb