Sha256: aab0f8991c2594a30f3107a537a3f192704304a85a94e084d4ad0366ad992fce

Contents?: true

Size: 494 Bytes

Versions: 1

Compression:

Stored size: 494 Bytes

Contents

require 'yaml'

module Metastore
  module Storage
    class Base

      def initialize(file)
        @file = file
      end

      def contents
        file.exist? ? read : {}
      end

      def save!(values)
        File.open(file.to_s, 'w') { |f| f.write(to_write(values)) }
      end

      private

        attr_reader :file

        def read
          raise NotImplementedError
        end

        def to_write(values)
          raise NotImplementedError
        end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metastore-0.3.0 lib/metastore/storage/base.rb