class Array

Public Instance Methods

apricot_call(idx) click to toggle source
# File lib/apricot/ruby_ext.rb, line 37
def apricot_call(idx)
  self[idx]
end
apricot_inspect() click to toggle source

Adapted from Array#inspect. This version prints no commas and calls apricot_inspect on its elements. e.g. [1 2 3]

# File lib/apricot/ruby_ext.rb, line 24
def apricot_inspect
  return '[]' if size == 0

  str = '['

  return '[...]' if Thread.detect_recursion self do
    each {|x| str << x.apricot_inspect << ' ' }
  end

  str.chop!
  str << ']'
end
Also aliased as: apricot_str
apricot_str()
Alias for: apricot_inspect
to_seq() click to toggle source
# File lib/apricot/ruby_ext.rb, line 43
def to_seq
  if length == 0
    nil
  else
    Seq.new(self, 0)
  end
end