class FileEntry

FileEntry is used as a simple container to store information about the file like metadata, size or checksum.

Attributes

checksum[RW]
metadata[RW]
name[RW]
path[RW]
size[RW]

Public Class Methods

new(path, name) click to toggle source
# File lib/filentory/fileentry.rb, line 6
def initialize(path, name)
  @path = path
  @name = name
end

Public Instance Methods

last_modified() click to toggle source

Get the last_modified date

# File lib/filentory/fileentry.rb, line 18
def last_modified
  DateTime.iso8601(@last_modified)
end
last_modified=(date) click to toggle source

Set the last_modified date. It uses the date.strftime method to convert it in a ISO 8601 format to be radable in JSON.

# File lib/filentory/fileentry.rb, line 13
def last_modified=(date)
  @last_modified = date.strftime("%FT%T%:z")
end
to_s() click to toggle source

Overrides to_s to get a human readable output.

# File lib/filentory/fileentry.rb, line 23
def to_s
  @path + @name + " (" + @size.to_s + ") - " + @last_modified
end