class Buby::BubyArrayWrapper

Attributes

array_obj[R]

Public Class Methods

new(obj) click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 8
def initialize(obj)
  @array_obj = obj
end

Public Instance Methods

[](*args) click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 12
def [](*args)
  if args.size == 1 and args.first.kind_of? Numeric
    self.array_obj[args[0]]
  else
    self.to_a(*args)
  end
end
each() { |array_obj| ... } click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 20
def each
  self.array_obj.size.times do |idx|
    yield self.array_obj[idx]
  end
end
first() click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 31
def first
  return(self.array_obj[0]) if(self.size > 0)
end
last() click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 35
def last
  return self.array_obj[self.size - 1] if(self.size > 0)
end
length() click to toggle source
Alias for: size
size() click to toggle source
# File lib/buby/extends/buby_array_wrapper.rb, line 26
def size
  self.array_obj.size
end
Also aliased as: length