Class: Zgomot::Comp::Scale

Inherits:
Object show all
Defined in:
lib/zgomot/comp/scale.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(int, shift) ⇒ Scale

Returns a new instance of Scale.



7
8
9
10
11
12
# File 'lib/zgomot/comp/scale.rb', line 7

def initialize(int, shift)
  @intervals = int
  @shift = shift - 1
  @scale = int.clone
  self.shift.times{self.next}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &blk) ⇒ Object



18
19
20
# File 'lib/zgomot/comp/scale.rb', line 18

def method_missing(method, *args, &blk )
  scale.send(method, *args, &blk)
end

Instance Attribute Details

#intervalsObject (readonly)

Returns the value of attribute intervals.



5
6
7
# File 'lib/zgomot/comp/scale.rb', line 5

def intervals
  @intervals
end

#scaleObject (readonly)

Returns the value of attribute scale.



5
6
7
# File 'lib/zgomot/comp/scale.rb', line 5

def scale
  @scale
end

#shiftObject (readonly)

Returns the value of attribute shift.



5
6
7
# File 'lib/zgomot/comp/scale.rb', line 5

def shift
  @shift
end

Instance Method Details

#nextObject



14
15
16
# File 'lib/zgomot/comp/scale.rb', line 14

def next
  scale.push(scale.shift)
end