Class: LS4::MemoryUpdateLog

Inherits:
UpdateLogService show all
Defined in:
lib/ls4/service/ulog_memory.rb

Instance Method Summary collapse

Methods inherited from UpdateLogService

#shutdown

Methods inherited from Service

init

Methods included from EventBus::SingletonMixin

#ebus_bind!, #ebus_connect, extended

Methods included from EventBus::BusMixin

#ebus_all_slots, #ebus_disconnect!

Methods included from EventBus::DeclarerBase::Methods

#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots

Methods included from EventBus::DeclarerBase

#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

#closeObject



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