class Uke class Chord attr_reader :name, :key, :positions, :fingers def initialize(line) parts = line.split(/\s{2,}/).map { |part| part.split(',') } @name = parts[0].join.tr(' ', '') @key = @name[0...2] @positions = parts[1].map(&:to_i) @fingers = parts[2] && parts[2].map(&:to_i) end end ENHARMONIC_EQUIVALENTS = { 'A#' => 'Bb', 'C#' => 'Db', 'D#' => 'Eb', 'F#' => 'Gb', 'G#' => 'Ab' } # compare https://ukulele-chords.com and https://ukulelehelper.com CHORDS_RAW = <