Module: JazzModel::ModeSequence

Defined in:
lib/jazz_model/mode_sequence.rb

Overview

Extends the Scale.modes association by allowing indexed access to modes. Whn using it in this manner, key context is passed along.

Instance Method Summary collapse

Instance Method Details

#[](value) ⇒ Object



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

def [](value)
  mode_object = self.find(:first, :conditions => ["name = ? OR mode = ?", value, value])
  return nil if mode_object.nil?
    
  # Pass Along Key Information
  mode_object.key = proxy_owner.key if proxy_owner.respond_to?(:key) and !proxy_owner.key.nil?
  mode_object
end