class Sequence::OfArray

Public Instance Methods

append(arr) click to toggle source
# File lib/sequence/indexed.rb, line 102
def append(arr)
  sz=size
  @data.push(*arr)
  notify_change(self,sz,0,arr.size)
  self
end
index(pat,offset=0) click to toggle source

a better, string-like index… with an offset parameter scalar matchers only

# File lib/sequence/indexed.rb, line 87
def index(pat,offset=0)
  pat=pat.dup
  class<<pat; alias == ===; end
  offset.zero? and return( @data.index pat)
  @data[offset..-1].index(pat)+offset
end
new_data() click to toggle source
# File lib/sequence/indexed.rb, line 109
def new_data
  []
end
rindex(pat,offset=size) click to toggle source

a better, string-like rindex… with an offset parameter scalar matchers only

# File lib/sequence/indexed.rb, line 96
def rindex(pat,offset=size)
  pat=pat.dup
  class<<pat; alias == ===; end
  (offset==size ? @data : @data[0...offset]).rindex pat
end