Sha256: cd749babceaeed291fc7df9d02a50f16f6b2ae35469cbe25edd2f5fe11425829

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

module Tori
  module Backend
    class FileSystem
      attr_accessor :root
      def initialize(root)
        @root = root
        FileUtils.mkdir_p @root.to_s
      end

      def copy(form_path, to_filename)
        IO.copy_stream form_path.to_s, path(to_filename)
      end

      def delete(filename)
        ::File.unlink path(filename)
      end

      def exist?(filename)
        ::File.exist? path(filename)
      end
      alias exists? exist?

      def read(filename)
        ::File.read path(filename)
      end

      def path(filename)
        @root.join filename.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tori-0.0.4 lib/tori/backend/filesystem.rb