Class: RoCommands::Info
- Includes:
- DSL::RoFile
- Defined in:
- lib/ro_commands/info.rb
Defined Under Namespace
Classes: RoFile
Instance Method Summary collapse
Methods included from DSL::RoFile
Methods inherited from Base
describe, inherited, method_added, meths, start, usage
Methods included from Bash
#_bash, #add_time, #bash, #bash_capture, #bash_capture_array, #bash_lines, #bash_per, #bash_system, #bundle_exec, #err, err, #handle_path, #kernel_system, out, #out, #status, status
Instance Method Details
#list(path, recursive = false) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ro_commands/info.rb', line 29 def list(path, recursive=false) if recursive find(path).each do |f| files << RoFile.new(f, size(f)) end Out.out files.sort_by(&:size) else Dir[File.join(path, "**")].each do |f| if dir?(f) s = find(f).inject(0) do |total_size, file| total_size += size(file).to_i end rf = RoFile.new(f, s) else rf = RoFile.new(f, size(f)) end files << rf end Out.out files.compact.sort_by(&:size) end end |