Sha256: fe09a86efbbe1bbce7cc1c91f3f02d6e7c5bb3e5910583171d1e4b128cb740c7

Contents?: true

Size: 463 Bytes

Versions: 4

Compression:

Stored size: 463 Bytes

Contents

class HeadMusic::Quality
  QUALITY_NAMES = %w[perfect major minor diminished augmented].map(&:to_sym)

  def self.get(identifier)
    @qualities ||= {}
    identifier = identifier.to_s.to_sym
    @qualities[identifier] ||= new(identifier) if QUALITY_NAMES.include?(identifier)
  end

  attr_reader :name
  delegate :to_s, to: :name

  def initialize(name)
    @name = name
  end

  def ==(other)
    self.to_s == other.to_s
  end

  private_class_method :new
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
head_music-0.4.0 lib/head_music/quality.rb
head_music-0.3.1 lib/head_music/quality.rb
head_music-0.3.0 lib/head_music/quality.rb
head_music-0.1.5 lib/head_music/quality.rb