Class: LS4::RelayTimeStampSelector

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

Constant Summary collapse

IMPLS =
{}

Class Method Summary collapse

Class Method Details

.open!Object



75
76
77
# File 'lib/ls4/service/rts.rb', line 75

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

.register(name, klass) ⇒ Object



43
44
45
46
# File 'lib/ls4/service/rts.rb', line 43

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

.select!(uri) ⇒ Object



68
69
70
71
72
73
# File 'lib/ls4/service/rts.rb', line 68

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

  RelayTimeStampBus.init(expr)
end

.select_class(uri) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ls4/service/rts.rb', line 48

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 RelayTimeStamp type: #{type}"
  end

  return klass, expr
end