class Eax::EaxDir

Attributes

eax_files[RW]
list[RW]
options[RW]

Public Class Methods

new(options) click to toggle source
# File lib/eax.rb, line 24
def initialize(options)
  @eax_files = []
  @options = options
  hidden = (options.all? or options.long?)
  order(
      FileListing.list_files_in(options.arguments.first || Dir.pwd, hidden: hidden),
      by: (options[:sort] || :name).to_sym,
      desc: options.reverse?
  )
end

Public Instance Methods

to_s() click to toggle source
# File lib/eax.rb, line 35
def to_s
  files_info = eax_files.map {|file| file.output(options) }
  if print_list?
    files_info.join("\n")
  else
    files_info.join(' ' * 3)
  end
end

Private Instance Methods

init_eax_files(files) click to toggle source
# File lib/eax.rb, line 50
def init_eax_files(files)
  files.each do |file|
    @eax_files << EaxFile.new(file)
  end
end
order(files, by: :name, desc: false) click to toggle source
# File lib/eax.rb, line 56
def order(files, by: :name, desc: false)
  case by
    when :name
      files.sort!
      files.reverse! if desc
      init_eax_files files
    else
      init_eax_files files
  end
end
print_list?() click to toggle source