Method: Dirk#files

Defined in:
lib/dirk.rb

#files(options = {}) ⇒ Object

creates a hash of Dirk objects for any non-system files in the current directory



61
62
63
64
65
66
67
68
69
# File 'lib/dirk.rb', line 61

def files(options = {})
  resize_images_if_needed  
  files = get_children("file").collect do |file| 
    Dirk.new(file, { :attr_file => file.basename.to_s.gsub(file.extname, '.txt') })
  end

  files.sort! { |a, b| a.send(options[:sort]).to_s <=> b.send(options[:sort]).to_s } if options[:sort]
  files
end