Class: CouchMigrate::BasePersistedList
- Inherits:
-
Object
- Object
- CouchMigrate::BasePersistedList
show all
- Defined in:
- lib/couch_migrate/base_persisted_list.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BasePersistedList.
4
5
6
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 4
def initialize
@list = []
end
|
Instance Method Details
#add(arr) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 20
def add(arr)
raise "argument must be an array" unless arr.is_a?(Array)
@list.concat(arr).uniq!
write
self
end
|
#get ⇒ Object
8
9
10
11
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 8
def get
read
@list
end
|
#remove(arr) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 27
def remove(arr)
raise "argument must be an array" unless arr.is_a?(Array)
@list -= arr
write
self
end
|
#reset ⇒ Object
34
35
36
37
38
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 34
def reset
@list = []
cleanup
self
end
|
#set(arr) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/couch_migrate/base_persisted_list.rb', line 13
def set(arr)
raise "argument must be an array" unless arr.is_a?(Array)
@list = arr.dup
write
self
end
|