Sha256: 296a6126d13a0bd7cb27f290a3e9ef3c72623a1ea2ae879939aa3405f6106e63
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
require 'vedeu/models/interface' # Todo: mutation (persistence) module Vedeu module API EntityNotFound = Class.new(StandardError) def use(name) Vedeu::Interface.new(Store.query(name)) end module Store extend self def create(attributes) storage.store(attributes[:name], attributes) end def query(name) attributes = storage.fetch(name) do fail EntityNotFound, 'Interface was not found.' end end def reset @storage = {} end private def storage @storage ||= {} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.9 | lib/vedeu/api/store.rb |
vedeu-0.1.8 | lib/vedeu/api/store.rb |