Class: SugarCube::AnonymousArray

Inherits:
Array
  • Object
show all
Defined in:
lib/cocoa/sugarcube-anonymous/anonymous_array.rb

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object


4
5
6
7
# File 'lib/cocoa/sugarcube-anonymous/anonymous_array.rb', line 4

def [] index
  o = super.to_object
  self[index] = o
end

#firstObject


9
10
11
# File 'lib/cocoa/sugarcube-anonymous/anonymous_array.rb', line 9

def first
  self.size == 0 ? nil : self[0]
end

#lastObject


13
14
15
16
# File 'lib/cocoa/sugarcube-anonymous/anonymous_array.rb', line 13

def last
  c = self.size
  c == 0 ? nil : self[c - 1]
end

#to_objectObject


18
19
20
# File 'lib/cocoa/sugarcube-anonymous/anonymous_array.rb', line 18

def to_object
  self
end