Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/ext/array.rb
Instance Method Summary collapse
- #completely_empty? ⇒ Boolean
-
#dimensions(n = 0) ⇒ Object
Taken from David Richards Data Frame (I’ll put the url up once I get internet).
- #shuffle ⇒ Object
Instance Method Details
#completely_empty? ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ext/array.rb', line 6 def completely_empty? empty? if dimensions == 1 empty = true each do |n| unless n.is_a?(Array) empty = false else empty = false unless n.empty? end end empty end |
#dimensions(n = 0) ⇒ Object
Taken from David Richards Data Frame (I’ll put the url up once I get internet)
21 22 23 24 |
# File 'lib/ext/array.rb', line 21 def dimensions(n=0) n += 1 self.first.is_a?(Array) ? self.first.dimensions(n) : n end |
#shuffle ⇒ Object
2 3 4 |
# File 'lib/ext/array.rb', line 2 def shuffle self.sort_by {rand} end |