Sha256: daa94ae2efa2ab5c2147aa15054ffe52ceed73f9a4371790ab477caf277fdd2e
Contents?: true
Size: 755 Bytes
Versions: 1
Compression:
Stored size: 755 Bytes
Contents
module Trax module Model class Registry class_attribute :models self.models ||= ::Hashie::Mash.new class << self delegate :key?, :to => :models delegate :each, :to => :models end def self.register_trax_model(model) unless models.key?(model.trax_registry_key) models[model.trax_registry_key] = model end end def self.model_type_for_uuid(str) prefix = str[0..1] uuid_map.fetch(prefix) end def self.uuid_map @uuid_map ||= models.values.reject!{|model| !model.try(:uuid_prefix) }.inject(::Hashie::Mash.new) do |result, model| result[model.uuid_prefix] = model result end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trax_model-0.0.1 | lib/trax/model/registry.rb |