class Ferver::FileList
A representation of Ferver's file list
Public Class Methods
new(files)
click to toggle source
Create a new instance with given directory
# File lib/ferver/file_list.rb, line 9 def initialize(files) @files = files.sort_by { |f| f.name.downcase } end
Public Instance Methods
each(&block)
click to toggle source
# File lib/ferver/file_list.rb, line 13 def each(&block) @files.each(&block) end
file_by_id(id)
click to toggle source
Fetch a file by its index An id out of range with raise FileNotFoundError
# File lib/ferver/file_list.rb, line 24 def file_by_id(id) @files.at(id) || raise(FileNotFoundError, "File id=#{id} not found") end
size()
click to toggle source
# File lib/ferver/file_list.rb, line 17 def size @files.size end