Class: Array

Inherits:
Object show all
Defined in:
lib/api/hit_sq.rb,
lib/music_coder.rb

Instance Method Summary collapse

Instance Method Details

#add_e(array) ⇒ Object

add all elements and fit if i’m too small



39
40
41
42
43
44
45
46
47
# File 'lib/music_coder.rb', line 39

def add_e (array)
  if !array.nil? && array.count > 0
    array.count.times do |i|
      self<<0 if i > self.count-1
      self[i] += array[i]
    end
  end
  self
end

#add_e_no_resize(array) ⇒ Object

add all elements and fit if i’m too small



49
50
51
52
53
54
# File 'lib/music_coder.rb', line 49

def add_e_no_resize (array)
  self.count.times do |i|
    self[i] += array[i]
  end
  self
end

#HitSqObject



162
163
164
165
166
# File 'lib/api/hit_sq.rb', line 162

def HitSq
  h=HitSq.new
  h<<self
  h
end

#move(val) ⇒ Object

return a new HitSq. a shortcut for HitSq.new.move(val)



169
170
171
172
173
174
# File 'lib/api/hit_sq.rb', line 169

def move(val)
  self.collect! {|x| x=x+val} # delay all
  h=HitSq.new
  h<<self
  h
end