Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/misc/misc.rb,
lib/symphony/symphony.rb

Direct Known Subclasses

HomogeneousArray, TypedArray

Instance Method Summary collapse

Instance Method Details

#/(dimensions) ⇒ Object



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

def /(dimensions)
  inject([]) do |ary, x|
    ary << [] if [*ary.last].nitems % len == 0
    ary.last << x
    ary
  end
end

#to_homogeneous(of_type) ⇒ Object



116
117
118
119
120
# File 'lib/symphony/symphony.rb', line 116

def to_homogeneous(of_type)
  harray = HomogeneousArray.new(of_type)
  self.each{ |item| harray << item }
  harray
end