Sha256: dea03d0f6b110966c3cf8993e75cd59b7221298eaf7be7c395c3949d022bcd3d

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 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(_)
          raise NotImplementedError
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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