Class: Persistors::Flash
- Inherits:
-
Base
show all
- Defined in:
- lib/volt/models/persistors/flash.rb
Instance Method Summary
collapse
Methods inherited from Base
#changed, #event_added, #event_removed, #loaded, #removed
Constructor Details
#initialize(model) ⇒ Flash
5
6
7
|
# File 'lib/volt/models/persistors/flash.rb', line 5
def initialize(model)
@model = model
end
|
Instance Method Details
#added(model, index) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/volt/models/persistors/flash.rb', line 9
def added(model, index)
if Volt.client?
%x{
setTimeout(function() {
self.$clear_model(model);
}, 5000);
}
end
end
|
#clear_model(model) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/volt/models/persistors/flash.rb', line 20
def clear_model(model)
@model.delete(model)
if @model.size == 0
collection_name = @model.path[-1]
@model.parent.delete(collection_name)
end
end
|