Sha256: a1bbd489dbb0a2c1571e16954a2727a91c23b7739557ac26fbe37f0cc04979b8
Contents?: true
Size: 651 Bytes
Versions: 2
Compression:
Stored size: 651 Bytes
Contents
module DataGenerator module DataStorage @data ||= {} class << self def store(ns, key, value) check_ns(ns) @data[ns][key] = value end def extract(ns, key=nil) check_ns(ns) key ? @data[ns][key] : @data[ns] end def clear_ns(ns) init_ns(ns) end private def check_ns(ns) if ns init_ns(ns) if ns_absent?(ns) else raise 'Data storage namespace can not be empty' end end def ns_absent?(ns) !@data.key?(ns) end def init_ns(ns) @data[ns] = {} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
howitzer-0.0.3 | lib/howitzer/utils/data_generator/data_storage.rb |
howitzer-0.0.1 | lib/howitzer/utils/data_generator/data_storage.rb |