Sha256: ee416983fbf36ac0791f790cb7ecadd070f5769cc8090e581cc73b1a6d56abfa
Contents?: true
Size: 651 Bytes
Versions: 4
Compression:
Stored size: 651 Bytes
Contents
module Project class Lookup class << self def store @store = {} unless @store @store end def set(key, data) store[key.to_sym] = data end alias :register :set def get(key) store[key.to_sym] ? return_object(store[key.to_sym]) : nil end alias :find :get def load_from_hash(hash) hash.each_pair do |key, data| store[key] = data end end protected def return_object(data) raise AbstractClassError, "this is an abstract class method and should not be called directly." end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
project-0.9.3 | lib/project/lookup.rb |
project-0.9.2 | lib/project/lookup.rb |
project-0.9.0 | lib/project/lookup.rb |
project-0.8.0 | lib/project/lookup.rb |