Class: Layer::Patch::Array
- Inherits:
-
Base
- Object
- SimpleDelegator
- Base
- Layer::Patch::Array
show all
- Defined in:
- lib/layer/patch/array.rb
Instance Attribute Summary
Attributes inherited from Base
#patch
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #wrap
Instance Method Details
#<<(value) ⇒ Object
Also known as:
push
16
17
18
19
|
# File 'lib/layer/patch/array.rb', line 16
def <<(value)
patch.add(value)
super
end
|
#[]=(index, value) ⇒ Object
11
12
13
14
|
# File 'lib/layer/patch/array.rb', line 11
def []=(index, value)
patch.add_index(index, value)
super
end
|
#clear ⇒ Object
37
38
39
40
|
# File 'lib/layer/patch/array.rb', line 37
def clear
patch.replace([])
super
end
|
#concat(values) ⇒ Object
27
28
29
30
|
# File 'lib/layer/patch/array.rb', line 27
def concat(values)
values.each { |value| patch.add(value) }
super
end
|
#delete(value) ⇒ Object
47
48
49
50
|
# File 'lib/layer/patch/array.rb', line 47
def delete(value)
patch.remove(value)
super
end
|
#delete_at(index) ⇒ Object
42
43
44
45
|
# File 'lib/layer/patch/array.rb', line 42
def delete_at(index)
patch.remove_index(index)
super
end
|
#insert(offset, values) ⇒ Object
32
33
34
35
|
# File 'lib/layer/patch/array.rb', line 32
def insert(offset, values)
values.each_with_index { |value, index| patch.add_index(offset + index, value) }
super
end
|
#pop ⇒ Object
52
53
54
55
|
# File 'lib/layer/patch/array.rb', line 52
def pop
patch.remove_index(length)
super
end
|
#prepare_base(base) ⇒ Object
5
6
7
8
9
|
# File 'lib/layer/patch/array.rb', line 5
def prepare_base(base)
base.each_with_index.map do |(value, index)|
wrap(index, value)
end
end
|
#replace(values) ⇒ Object
62
63
64
65
|
# File 'lib/layer/patch/array.rb', line 62
def replace(values)
patch.replace(values)
super
end
|
#shift ⇒ Object
57
58
59
60
|
# File 'lib/layer/patch/array.rb', line 57
def shift
patch.remove_index(0)
super
end
|
#unshift(value) ⇒ Object
22
23
24
25
|
# File 'lib/layer/patch/array.rb', line 22
def unshift(value)
patch.add_index(0, value)
super
end
|