Sha256: 1346fbe5b1d359e84d78237796466362058804e4407227661331baae0eaedb6e
Contents?: true
Size: 999 Bytes
Versions: 4
Compression:
Stored size: 999 Bytes
Contents
class Servel::Entry extend Servel::Instrumentation attr_reader :ftype, :type, :media_type, :listing_classes, :icon, :href, :name, :size, :mtime def initialize(ftype:, type:, media_type: nil, listing_classes:, icon:, href:, name:, size: nil, mtime: nil) @ftype = ftype @type = type @media_type = media_type @listing_classes = listing_classes @icon = icon @href = href @name = name @size = size @mtime = mtime end def directory? @ftype == :directory end def file? @ftype == :file end def media? !@media_type.nil? end def as_json(*) { icon: @icon, href: Rack::Utils.escape_path(@href), class: @listing_classes, mediaType: @media_type, name: @name, type: @type, size: @size.to_i, sizeText: @size.nil? ? "-" : @size, mtime: @mtime.to_i, mtimeText: @mtime.nil? ? "-" : @mtime.strftime("%e %b %Y %l:%M %p"), media: media? } end instrument :as_json end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
servel-0.24.0 | lib/servel/entry.rb |
servel-0.23.0 | lib/servel/entry.rb |
servel-0.22.0 | lib/servel/entry.rb |
servel-0.21.0 | lib/servel/entry.rb |