Class: Juicy::ChordProgression
- Inherits:
-
Object
- Object
- Juicy::ChordProgression
- Defined in:
- lib/juicy/chord_progression.rb
Instance Attribute Summary collapse
-
#chords ⇒ Object
Returns the value of attribute chords.
Instance Method Summary collapse
- #initial_play_time ⇒ Object
-
#initialize ⇒ ChordProgression
constructor
A new instance of ChordProgression.
- #inspect ⇒ Object
- #play ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ ChordProgression
Returns a new instance of ChordProgression.
7 8 9 10 11 12 13 |
# File 'lib/juicy/chord_progression.rb', line 7 def initialize @chords = [] @chords << Chord.new(root: :C) @chords << Chord.new(root: :F, inversion: 2) @chords << Chord.new(root: :G, inversion: 1) @chords << Chord.new(root: :C) end |
Instance Attribute Details
#chords ⇒ Object
Returns the value of attribute chords.
5 6 7 |
# File 'lib/juicy/chord_progression.rb', line 5 def chords @chords end |
Instance Method Details
#initial_play_time ⇒ Object
36 37 38 |
# File 'lib/juicy/chord_progression.rb', line 36 def initial_play_time 0 end |
#inspect ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/juicy/chord_progression.rb', line 15 def inspect output = "" @chords.each do |chord| output += chord.inspect + ", " end output[0..-3] end |
#play ⇒ Object
40 41 42 43 44 |
# File 'lib/juicy/chord_progression.rb', line 40 def play @chords.each do |chord| 4.times {chord.play} end end |
#to_a ⇒ Object
31 32 33 34 |
# File 'lib/juicy/chord_progression.rb', line 31 def to_a [Chord.new(root: "C")] @chords end |
#to_s ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/juicy/chord_progression.rb', line 23 def to_s output = "" @progression.each do |scale_degree| output += scale_degree.to_s + ", " end output[0..-3] end |