Class: Zgomot::Comp::Mode
Class Attribute Summary collapse
-
.chords ⇒ Object
readonly
Returns the value of attribute chords.
-
.intervals ⇒ Object
readonly
Returns the value of attribute intervals.
-
.modes ⇒ Object
readonly
Returns the value of attribute modes.
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
Instance Method Summary collapse
- #chords(chord = :scale) ⇒ Object
-
#initialize(mode = 1) ⇒ Mode
constructor
A new instance of Mode.
- #method_missing(meth, *args, &blk) ⇒ Object
Constructor Details
#initialize(mode = 1) ⇒ Mode
Returns a new instance of Mode.
19 20 21 22 23 24 25 26 27 |
# File 'lib/zgomot/comp/mode.rb', line 19 def initialize(mode = 1) @mode = case mode when Symbol then self.class.modes.index(mode)+1 when Fixnum then mode % 7 when nil then 1 else raise(Zgomot::Error, "#{mode.inspect} is invalid mode") end @scale = Scale.new(self.class.intervals, @mode) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
33 34 35 |
# File 'lib/zgomot/comp/mode.rb', line 33 def method_missing(meth, *args, &blk ) scale.send(meth, *args, &blk) end |
Class Attribute Details
.chords ⇒ Object (readonly)
Returns the value of attribute chords.
14 15 16 |
# File 'lib/zgomot/comp/mode.rb', line 14 def chords @chords end |
.intervals ⇒ Object (readonly)
Returns the value of attribute intervals.
14 15 16 |
# File 'lib/zgomot/comp/mode.rb', line 14 def intervals @intervals end |
.modes ⇒ Object (readonly)
Returns the value of attribute modes.
14 15 16 |
# File 'lib/zgomot/comp/mode.rb', line 14 def modes @modes end |