class DZT::FileStorage

Public Class Methods

new(options = {}) click to toggle source

@param destination: Full directory in which to output tiles, defaults to 'tiles' in the current dir.

# File lib/dzt/file_storage.rb, line 6
def initialize(options = {})
  @store_path = options[:destination] || File.join(Dir.pwd, 'tiles')
end

Public Instance Methods

exists?() click to toggle source
# File lib/dzt/file_storage.rb, line 10
def exists?
  File.directory?(@store_path) && !Dir['@{@store_path}/*'].empty?
end
mkdir(path) click to toggle source
# File lib/dzt/file_storage.rb, line 18
def mkdir(path)
  FileUtils.mkdir_p(path)
end
storage_location(level) click to toggle source
# File lib/dzt/file_storage.rb, line 14
def storage_location(level)
  File.join(@store_path, level.to_s)
end
write(file, dest, options = {}) click to toggle source
# File lib/dzt/file_storage.rb, line 22
def write(file, dest, options = {})
  quality = options[:quality]
  file.write(dest) { self.quality = quality if quality }
end