Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (25 sloc) 490 Bytes
class Mo
attr_reader :path, :href
DISK_PATH = "#{APP_ROOT}/public/mos"
def initialize(path)
@path = path
end
def href
"/mos/#{File.basename(self.path)}"
end
def created_at
File.ctime(self.path)
end
def updated_at
File.mtime(self.path)
end
class << self
def all
files.sort{|a,b| File.basename(a) <=> File.basename(b)}.map{|f| new(f) }
end
private
def files
Dir["#{DISK_PATH}/*"]
end
end
end