lib/xi/pattern/generators.rb in xi-lang-0.1.6 vs lib/xi/pattern/generators.rb in xi-lang-0.2.0
- old
+ new
@@ -59,11 +59,11 @@
# @example
# peek P.rand([1, 2, 3]) #=> [2]
# peek P.rand([1, 2, 3, 4], 6) #=> [1, 3, 2, 2, 4, 3]
#
# @param list [#each] list of values
- # @param repeats [Fixnum, Symbol] number or inf (default: 1)
+ # @param repeats [Integer, Symbol] number or inf (default: 1)
# @return [Pattern]
#
def rand(list, repeats=1)
Pattern.new(list, size: repeats) do |y|
ls = list.to_a
@@ -81,11 +81,11 @@
# @example
# peek P.xrand([1, 2, 3, 4, 5]) #=> [4]
# peek P.xrand([1, 2, 3], 8) #=> [1, 3, 2, 3, 1, 2, 3, 2]
#
# @param list [#each] list of values
- # @param repeats [Fixnum, Symbol] number or inf (default: 1)
+ # @param repeats [Integer, Symbol] number or inf (default: 1)
# @return [Pattern]
#
def xrand(list, repeats=1)
Pattern.new(list, size: repeats) do |y|
ls = list.to_a
@@ -107,11 +107,11 @@
# @example
# peek P.shuf([1, 2, 3, 4, 5]) #=> [5, 3, 4, 1, 2]
# peek P.shuf([1, 2, 3], 3) #=> [2, 3, 1, 2, 3, 1, 2, 3, 1]
#
# @param list [#each] list of values
- # @param repeats [Fixnum, Symbol] number or inf (default: 1)
+ # @param repeats [Integer, Symbol] number or inf (default: 1)
# @return [Pattern]
#
def shuf(list, repeats=1)
Pattern.new(list, size: list.size * repeats) do |y|
xs = list.to_a.shuffle
@@ -135,12 +135,12 @@
# @example +quant+ determines the size, +delta+ the total duration
# P.sin(8).size #=> 8
# P.sin(22).duration #=> (1/1)
# P.sin(19, 2).duration #=> (2/1)
#
- # @param quant [Fixnum]
- # @param delta [Fixnum] (default: 1)
+ # @param quant [Integer]
+ # @param delta [Integer] (default: 1)
# @return [Pattern]
#
def sin(quant, delta=1)
Pattern.new(size: quant, delta: delta / quant) do |y|
quant.times do |i|
@@ -158,11 +158,11 @@
#
# @example
# peek P.sin1(8).map { |i| i.round(2) }
# #=> [0.5, 0.85, 1.0, 0.85, 0.5, 0.15, 0.0, 0.15]
#
- # @param quant [Fixnum]
- # @param delta [Fixnum] (default: 1)
+ # @param quant [Integer]
+ # @param delta [Integer] (default: 1)
# @return [Pattern]
#
def sin1(quant, delta=1)
sin(quant, delta).scale(-1, 1, 0, 1)
end