Sha256: 93de24f15550f286295356f3f87e3fb6d75f689d0294ff48448d5cf39204f5d2
Contents?: true
Size: 632 Bytes
Versions: 13
Compression:
Stored size: 632 Bytes
Contents
require 'fileutils' module UniverseCompiler module Entity module Persistence attr_accessor :source_uri def self.load(uri) entity = YAML.load_file uri entity.source_uri = uri entity end def save(uri = source_uri, raise_error: true) valid? raise_error: raise_error FileUtils.mkpath File.dirname(uri) File.write uri, to_yaml, mode: 'w' self.source_uri = uri self end def delete universe.delete self unless self.source_uri.nil? FileUtils.rm self.source_uri end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems