Sha256: 277ec754e7ba73d728d10b4a02ba2c4974c9f76b46af8b8597fdf1587f9d3d2c

Contents?: true

Size: 461 Bytes

Versions: 22

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true

module Coltrane
  module Representation
    class Guitar
      class Note
        attr_reader :string, :fret

        def initialize(string, fret = nil)
          @string = string
          @fret   = fret
        end

        def pitch
          string + fret unless fret.nil?
        end

        def pitch_class
          pitch.pitch_class unless fret.nil?
        end

        alias note pitch_class
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
coltrane-4.1.2 lib/coltrane/representation/guitar/note.rb
coltrane-4.1.1 lib/coltrane/representation/guitar/note.rb
coltrane-4.1.0 lib/coltrane/representation/guitar/note.rb
coltrane-4.0.6 lib/coltrane/representation/guitar/note.rb
coltrane-4.0.5 lib/coltrane/representation/guitar/note.rb
coltrane-4.0.4 lib/coltrane/representation/guitar/note.rb
coltrane-4.0.3 lib/coltrane/representation/guitar/note.rb
coltrane-3.4.2 lib/coltrane/representation/guitar/note.rb
coltrane-3.4.1 lib/coltrane/representation/guitar/note.rb
coltrane-3.4.0 lib/coltrane/representation/guitar/note.rb
coltrane-3.3.3 lib/coltrane/representation/guitar/note.rb
coltrane-3.3.2 lib/coltrane/representation/guitar/note.rb
coltrane-3.3.1 lib/coltrane/representation/guitar/note.rb
coltrane-3.3.0 lib/coltrane/representation/guitar/note.rb
coltrane-3.2.0 lib/coltrane/representation/guitar/note.rb
coltrane-3.1.3 lib/coltrane/representation/guitar/note.rb
coltrane-3.1.2 lib/coltrane/representation/guitar/note.rb
coltrane-3.1.1 lib/coltrane/representation/guitar/note.rb
coltrane-3.1.0 lib/coltrane/representation/guitar/note.rb
coltrane-3.0.0 lib/coltrane/representation/guitar/note.rb