Sha256: 0f7dd6d8332b56fd9af19e79cf5a6a7a9d15160f0c695e755307deda7ca0839b
Contents?: true
Size: 578 Bytes
Versions: 15
Compression:
Stored size: 578 Bytes
Contents
require 'yaml' module Kafo class Store attr_accessor :data def initialize(path = nil) @data = {} load_path(path) if path end def load_path(path) if File.directory?(path) add_dir(path) else add_file(path) end end def add(data) @data.merge!(data) end def add_dir(path) Dir.glob(File.join(path, "*.yaml")).sort.each do |file| add_file(file) end end def add_file(file) add(YAML.load_file(file)) end def get(key) @data[key] end end end
Version data entries
15 entries across 15 versions & 1 rubygems