Sha256: 6947621c78d7b3160b2141e7f527cbd5b5734d3e9fa230658e5b6a745d543234

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

require "stashify/file"

module Stashify
  class File
    # An implementation for interacting with local files. The
    # constructor needs no information on top of what is included
    # {Stashify::File#initialize}, although it's important to note
    # that setting the contents parameter will not do anything.
    class Local < Stashify::File
      def contents
        ::File.read(path)
      end

      def write(contents)
        ::File.write(path, contents)
      end

      def delete
        ::File.delete(path)
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stashify-3.2.2 lib/stashify/file/local.rb
stashify-3.2.1 lib/stashify/file/local.rb