Class: LS4::UpdateLogSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/ls4/service/ulog.rb

Constant Summary collapse

IMPLS =
{}

Class Method Summary collapse

Class Method Details

.open!Object



66
67
68
# File 'lib/ls4/service/ulog.rb', line 66

def self.open!
	select!(ConfigBus.get_ulog_path)
end

.register(name, klass) ⇒ Object



34
35
36
37
# File 'lib/ls4/service/ulog.rb', line 34

def self.register(name, klass)
	IMPLS[name.to_sym] = klass
	nil
end

.select!(uri) ⇒ Object



59
60
61
62
63
64
# File 'lib/ls4/service/ulog.rb', line 59

def self.select!(uri)
	klass, expr = select_class(uri)
	klass.init

	UpdateLogBus.open(expr)
end

.select_class(uri) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ls4/service/ulog.rb', line 39

def self.select_class(uri)
	uri ||= "mem:"

	if m = /^(\w{1,8})\:(.*)/.match(uri)
		type = m[1].to_sym
		expr = m[2]
	else
		type = :file
		expr = uri
	end

	klass = IMPLS[type]

	unless klass
		"unknown UpdateLog type: #{type}"
	end

	return klass, expr
end