Class: Archaeopteryx::Mix

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

Instance Method Summary (collapse)

Constructor Details

- (Mix) initialize(attributes)

Returns a new instance of Mix



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

def initialize(attributes)
  @rhythms = attributes[:rhythms]
end

Instance Method Details

- (Object) mutate(measure)

Haskell style! Lisp style?! Recursion style! def notes(beat)

notes = []
@rhythms.each do |rhythm|
  notes << rhythm.notes(beat)
end

end



20
21
22
# File 'lib/mix.rb', line 20

def mutate(measure)
  @rhythms.each {|rhythm| rhythm.mutate(measure)}
end

- (Object) notes(beat)



6
7
8
9
10
11
12
# File 'lib/mix.rb', line 6

def notes(beat)
  notes = []
  @rhythms.each do |rhythm|
    notes << rhythm.notes(beat)
  end
  notes.flatten
end