Class: Hold::InMemory::ArrayCell

Inherits:
Object
  • Object
show all
Includes:
ArrayCell
Defined in:
lib/hold/in_memory/array_cell.rb

Instance Method Summary collapse

Methods included from ArrayCell

#can_get_class?, #can_get_item_class?, #can_set_class?, #can_set_item_class?, #get_lazy_array

Methods included from Cell

#can_get_class?, #can_set_class?, #clear, #empty?, #get_unless_empty, #set_if_empty, #set_unless_empty, #value, #value=

Constructor Details

#initialize(array = []) ⇒ ArrayCell

Returns a new instance of ArrayCell.



6
7
8
# File 'lib/hold/in_memory/array_cell.rb', line 6

def initialize(array=[])
  @array = array
end

Instance Method Details

#getObject



10
11
12
# File 'lib/hold/in_memory/array_cell.rb', line 10

def get
  @array.dup
end

#get_lengthObject



22
23
24
# File 'lib/hold/in_memory/array_cell.rb', line 22

def get_length
  @array.length
end

#get_slice(start, length) ⇒ Object



18
19
20
# File 'lib/hold/in_memory/array_cell.rb', line 18

def get_slice(start,length)
  @array[start, length]
end

#set(value) ⇒ Object



14
15
16
# File 'lib/hold/in_memory/array_cell.rb', line 14

def set(value)
  @array.replace(value)
end