Sha256: 4c4fb2aa6b7c5d41b9ea01f10673c78e525ecf8d4303bdfd70d471d3b064658d
Contents?: true
Size: 622 Bytes
Versions: 4
Compression:
Stored size: 622 Bytes
Contents
require 'yaml' module VersionInfo # Version data is stored in a yaml file as a simple hash, i.e. : # --- # major: 1 # minor: 1 # patch: 4 # author: jcangas class YamlStorage < Storage def default_file_name 'version_info.yml' end def load_from(io) values = YAML.load(io) # force keys as symbols values.keys.each{|k| values[k.to_sym] = values.delete(k)} data.assign(values) self end def save_to(io) values = data.to_hash.keys.compact.inject({}){|r, k| r[k.to_s] = data.send(k); r } YAML.dump(values, io) self end end end
Version data entries
4 entries across 4 versions & 1 rubygems