Class: Note
- Inherits:
-
Object
- Object
- Note
- Defined in:
- lib/chord_finder/note.rb
Constant Summary collapse
- ACCIDENTALS =
{ nil => "", "#" => "#", "!" => "#", "b" => "♭", "_" => "♭" }
- MUTED =
"x".freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Class Method Summary collapse
Instance Method Summary collapse
- #+(steps) ⇒ Object
- #==(other_note) ⇒ Object
-
#initialize(name, position = nil) ⇒ Note
constructor
A new instance of Note.
- #muted? ⇒ Boolean
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
16 17 18 |
# File 'lib/chord_finder/note.rb', line 16 def name @name end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
16 17 18 |
# File 'lib/chord_finder/note.rb', line 16 def position @position end |
Class Method Details
.find(name) ⇒ Object
10 11 12 |
# File 'lib/chord_finder/note.rb', line 10 def self.find(name) JOIN_SCALE.find_note(name) end |
Instance Method Details
#+(steps) ⇒ Object
29 30 31 |
# File 'lib/chord_finder/note.rb', line 29 def +(steps) SHARPS_SCALE[position + steps] end |
#==(other_note) ⇒ Object
25 26 27 |
# File 'lib/chord_finder/note.rb', line 25 def ==(other_note) position == other_note.position end |