Sha256: 80f4028a138ba5faf03285551c109873fecfde41a64e89555bad3ca11e4e50de

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

module DZT
  class FileStorage
    #
    # @param destination: Full directory in which to output tiles, defaults to 'tiles' in the current dir.
    #
    def initialize(options = {})
      @store_path = options[:destination] || File.join(Dir.pwd, 'tiles')
    end

    def exists?
      File.directory?(@store_path) && !Dir['@{@store_path}/*'].empty?
    end

    def storage_location(level)
      File.join(@store_path, level.to_s)
    end

    def mkdir(path)
      FileUtils.mkdir_p(path)
    end

    def write(file, dest, options = {})
      quality = options[:quality]
      file.quality quality
      file.write(dest)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
washi-0.1.1 lib/washi/mini_dzt/file_storage.rb