Sha256: 47204fe63dcf063e44391fc1600af1a976e9c152184e78fe68541edbcf91b973

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 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, @root.join(to_filename.to_s))
      end

      def delete(filename)
        ::File.unlink @root.join(filename.to_s)
      end

      def exist?(filename)
        ::File.exist? @root.join(filename.to_s)
      end

      def read(filename)
        ::File.read @root.join(filename.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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