Class: Niki::Part
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
Instance Method Summary collapse
- #for_instrument(instrument_name) ⇒ Object
-
#initialize(name, song, &block) ⇒ Part
constructor
A new instance of Part.
- #riff(name, instrument_name, &blk) ⇒ Object
Methods included from Chords
Constructor Details
#initialize(name, song, &block) ⇒ Part
Returns a new instance of Part.
7 8 9 10 11 12 |
# File 'lib/niki/part.rb', line 7 def initialize(name, song, &block) @name = name @song = song @notes = {} self.instance_eval(&block) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/niki/part.rb', line 3 def name @name end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
3 4 5 |
# File 'lib/niki/part.rb', line 3 def notes @notes end |
Instance Method Details
#for_instrument(instrument_name) ⇒ Object
14 15 16 |
# File 'lib/niki/part.rb', line 14 def for_instrument(instrument_name) @notes[instrument_name] || [] end |
#riff(name, instrument_name, &blk) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/niki/part.rb', line 18 def riff(name, instrument_name, &blk) riff = @song.get_riff(name) riff.notes.each do |args| send(instrument_name, *args) end end |