Class: S3Ranger::LocalDirectory

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ LocalDirectory

Returns a new instance of LocalDirectory.



81
82
83
# File 'lib/s3ranger/sync.rb', line 81

def initialize source
  @source = source
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



79
80
81
# File 'lib/s3ranger/sync.rb', line 79

def source
  @source
end

Instance Method Details

#list_filesObject



85
86
87
88
89
90
91
92
93
# File 'lib/s3ranger/sync.rb', line 85

def list_files
  Dir["#{@source}/**/*"].collect { |file|
    unless File.directory? file
      file = Pathname.new(file).cleanpath.to_s
      file_name = file.gsub(/^#{@source}\/?/, '')
      Node.new @source, file_name, File.stat(file).size
    end
  }.compact
end