Class: Array
- Inherits:
-
Object
show all
- Defined in:
- lib/motion-csv/motion-csv.rb
Instance Method Summary
collapse
Instance Method Details
#depth ⇒ Object
443
444
445
446
447
448
449
450
451
|
# File 'lib/motion-csv/motion-csv.rb', line 443
def depth
b, depth = self.dup, 1
until b==self.flatten
depth+=1
b=b.flatten(1)
end
depth
end
|
#to_csv ⇒ Object
431
432
433
434
435
436
437
438
439
440
441
|
# File 'lib/motion-csv/motion-csv.rb', line 431
def to_csv
MotionCSV.generate do |csv|
if self.depth == 2
self.each do |a|
csv << a
end
else
csv << self
end
end
end
|