Sha256: bd14d3021a79aa1afe63dc011a66250ccbeadb92d85af8675b6783261167bacc
Contents?: true
Size: 552 Bytes
Versions: 2
Compression:
Stored size: 552 Bytes
Contents
class Array def rotate_until &block return if block[] found = false length.times do push shift if block[] found = true break end end raise IndexError unless found end def rotate_until_first_equals obj rotate_until { at(0) == obj } end def slice_exists? slice start = slice.first len = slice.size each_with_index do |e, i| return true if e == start && self[i,len] == slice end false end def to_c Terraformer::Coordinate.from_array self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
terraformer-0.2.1 | lib/ext/array.rb |
terraformer-0.2.0 | lib/ext/array.rb |