Class: ColtraneInstruments::Guitar::Note
- Inherits:
-
Object
- Object
- ColtraneInstruments::Guitar::Note
- Defined in:
- lib/coltrane_instruments/guitar/note.rb
Instance Attribute Summary collapse
-
#fret ⇒ Object
readonly
Returns the value of attribute fret.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string, fret = nil) ⇒ Note
constructor
A new instance of Note.
- #pitch ⇒ Object
- #pitch_class ⇒ Object (also: #note)
Constructor Details
#initialize(string, fret = nil) ⇒ Note
Returns a new instance of Note.
8 9 10 11 |
# File 'lib/coltrane_instruments/guitar/note.rb', line 8 def initialize(string, fret = nil) @string = string @fret = fret end |
Instance Attribute Details
#fret ⇒ Object (readonly)
Returns the value of attribute fret.
6 7 8 |
# File 'lib/coltrane_instruments/guitar/note.rb', line 6 def fret @fret end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
6 7 8 |
# File 'lib/coltrane_instruments/guitar/note.rb', line 6 def string @string end |
Instance Method Details
#pitch ⇒ Object
13 14 15 |
# File 'lib/coltrane_instruments/guitar/note.rb', line 13 def pitch string + fret unless fret.nil? end |
#pitch_class ⇒ Object Also known as: note
17 18 19 |
# File 'lib/coltrane_instruments/guitar/note.rb', line 17 def pitch_class pitch.pitch_class unless fret.nil? end |