Sha256: 3f50d33e9fe63fe73a2426802ae0f5c4feaa9d6b0f3f206c673e9bf9f6886b5c
Contents?: true
Size: 531 Bytes
Versions: 10
Compression:
Stored size: 531 Bytes
Contents
module HeadMusic module NamedRudiment attr_reader :name delegate :to_s, to: :name def initialize(name) @name = name.to_s end def hash_key HeadMusic::Utilities::HashKey.for(name) end def self.included(base) base.extend(ClassMethods) end module ClassMethods def get_by_name(name) name = name.to_s @instances_by_name ||= {} key = HeadMusic::Utilities::HashKey.for(name) @instances_by_name[key] ||= new(name) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems