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.



107
108
109
# File 'lib/s3ranger/sync.rb', line 107

def initialize source
  @source = source
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



105
106
107
# File 'lib/s3ranger/sync.rb', line 105

def source
  @source
end

Instance Method Details

#list_filesObject



111
112
113
114
115
116
117
118
119
# File 'lib/s3ranger/sync.rb', line 111

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