Class: Eax::EaxDir

Inherits:
Object
  • Object
show all
Defined in:
lib/eax.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ EaxDir

Returns a new instance of EaxDir.



24
25
26
27
28
29
30
31
32
33
# 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

Instance Attribute Details

#eax_filesObject

Returns the value of attribute eax_files.



22
23
24
# File 'lib/eax.rb', line 22

def eax_files
  @eax_files
end

#listObject

Returns the value of attribute list.



22
23
24
# File 'lib/eax.rb', line 22

def list
  @list
end

#optionsObject

Returns the value of attribute options.



22
23
24
# File 'lib/eax.rb', line 22

def options
  @options
end

Instance Method Details

#to_sObject



35
36
37
38
39
40
41
42
# 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