Class: LS4::MemoryUpdateLog
Instance Method Summary
collapse
#shutdown
Methods inherited from Service
init
#ebus_bind!, #ebus_connect, extended
#ebus_all_slots, #ebus_disconnect!
#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots
#call_slot, #signal_slot
Instance Method Details
#append(data, &block) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/ls4/service/ulog_memory.rb', line 32
def append(data, &block)
@array.push(data)
begin
block.call
rescue
@array.pop
raise
end
end
|
#close ⇒ Object
28
29
30
|
# File 'lib/ls4/service/ulog_memory.rb', line 28
def close
@array.clear
end
|
#get(pos) ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/ls4/service/ulog_memory.rb', line 42
def get(pos)
data = @array[pos]
if data
return nil, pos
else
return data, pos+1
end
end
|
#open(expr) ⇒ Object
24
25
26
|
# File 'lib/ls4/service/ulog_memory.rb', line 24
def open(expr)
@array = []
end
|