Sha256: e34c3557d446f5d2c1d7a502b0e20bab0f358bd3c9da93d99e96432bb865361e
Contents?: true
Size: 857 Bytes
Versions: 4
Compression:
Stored size: 857 Bytes
Contents
require 'artii' require_relative "uke/version" require_relative "uke/chords" require_relative "uke/fretboard" class Uke def print_chord_list puts Uke::CHORDS.keys.join " " end def print_chords(which, style = nil) Array(which).each{ |chord_name| chords = CHORDS[chord_name] if !chords.empty? puts chords.reduce( chord_name_to_ascii_lines(chord_name) ){ |old_lines, chord| old_lines.zip(Fretboard.new(chord, style).lines).map(&:join) }.join($/) else $stderr.puts "\n #{chord_name} not found" end } end private def chord_name_to_ascii_lines(chord) a = Artii::Base.new# font: 'roman' res = [" ", " ", " "] res += a.asciify(chord).split($/) res += [" "] max = res.max_by(&:size).size res.map{ |l| " " + l.ljust(max) } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
uke-1.0.3 | lib/uke.rb |
uke-1.0.2 | lib/uke.rb |
uke-1.0.1 | lib/uke.rb |
uke-1.0.0 | lib/uke.rb |