Class: Archaeopteryx::RhythmWithoutEval

Inherits:
Object
  • Object
show all
Defined in:
lib/rhythm_without_eval.rb

Instance Method Summary (collapse)

Constructor Details

- (RhythmWithoutEval) initialize(attributes)

Returns a new instance of RhythmWithoutEval



3
4
5
6
# File 'lib/rhythm_without_eval.rb', line 3

def initialize(attributes)
  @mutation = attributes[:mutation]
  @drums = attributes[:drums]
end

Instance Method Details

- (Object) mutate(measure)



14
15
16
17
18
# File 'lib/rhythm_without_eval.rb', line 14

def mutate(measure)
  if @mutation[measure]
    @drums.each {|drum| drum.mutate}
  end
end

- (Object) notes(beat)



7
8
9
10
11
12
13
# File 'lib/rhythm_without_eval.rb', line 7

def notes(beat)
  drums = []
  @drums.each do |drum|
    drums << drum.note if drum.play? beat
  end
  drums
end