Class: Stave::Theory::Circle
- Inherits:
-
Object
- Object
- Stave::Theory::Circle
- Defined in:
- lib/stave/theory/circle.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, root:) ⇒ Circle
constructor
A new instance of Circle.
- #key_signatures ⇒ Object
- #notes ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
4 5 6 |
# File 'lib/stave/theory/circle.rb', line 4 def root @root end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/stave/theory/circle.rb', line 4 def type @type end |
Instance Method Details
#key_signatures ⇒ Object
17 18 19 |
# File 'lib/stave/theory/circle.rb', line 17 def key_signatures notes.map { |root| Scale.major_from(root).key_signature } end |
#notes ⇒ Object
11 12 13 14 15 |
# File 'lib/stave/theory/circle.rb', line 11 def notes 7.times.inject([root]) do |notes, _| notes + [notes.last + type.step] end end |