Class: Buby::BubyArrayWrapper Deprecated

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/buby/implants/buby_array_wrapper.rb

Overview

Deprecated.

Direct Known Subclasses

HttpRequestResponseList, ScanIssuesList

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Implants::Enumerable

#each_with_object

Constructor Details

#initialize(obj) ⇒ BubyArrayWrapper

Returns a new instance of BubyArrayWrapper.



9
10
11
# File 'lib/buby/implants/buby_array_wrapper.rb', line 9

def initialize(obj)
  @array_obj = obj
end

Instance Attribute Details

#array_objObject (readonly)

Returns the value of attribute array_obj.



7
8
9
# File 'lib/buby/implants/buby_array_wrapper.rb', line 7

def array_obj
  @array_obj
end

Instance Method Details

#[](*args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/buby/implants/buby_array_wrapper.rb', line 13

def [](*args)
  if args.size == 1 and args.first.kind_of? Numeric
    self.array_obj[args[0]]
  else
    self.to_a(*args)
  end
end

#eachObject



21
22
23
24
25
# File 'lib/buby/implants/buby_array_wrapper.rb', line 21

def each
  self.array_obj.size.times do |idx|
    yield self.array_obj[idx]
  end
end

#firstObject



32
33
34
# File 'lib/buby/implants/buby_array_wrapper.rb', line 32

def first
  return(self.array_obj[0]) if(self.size > 0)
end

#lastObject



36
37
38
# File 'lib/buby/implants/buby_array_wrapper.rb', line 36

def last
  return self.array_obj[self.size - 1] if(self.size > 0)
end

#sizeObject Also known as: length



27
28
29
# File 'lib/buby/implants/buby_array_wrapper.rb', line 27

def size
  self.array_obj.size
end