Sha256: 95176210623e8feaf360a0b7f643cc00dfcce8cc43d506f160797780461f7409
Contents?: true
Size: 461 Bytes
Versions: 19
Compression:
Stored size: 461 Bytes
Contents
class HeadMusic::Consonance LEVELS = %w[perfect imperfect dissonant] def self.get(name) @consonances ||= {} @consonances[name.to_sym] ||= new(name) if LEVELS.include?(name.to_s) end attr_reader :name delegate :to_s, to: :name def initialize(name) @name = name.to_s.to_sym end def ==(other) self.to_s == other.to_s end LEVELS.each do |method_name| define_method(:"#{method_name}?") { to_s == method_name } end end
Version data entries
19 entries across 19 versions & 1 rubygems