Module: LS4::MDSSelector

Defined in:
lib/ls4/service/mds.rb

Constant Summary collapse

IMPLS =
{}

Class Method Summary collapse

Class Method Details

.register(name, klass) ⇒ Object



168
169
170
171
# File 'lib/ls4/service/mds.rb', line 168

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

.select_class(uri) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/ls4/service/mds.rb', line 173

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

	klass = IMPLS[type]
	unless klass
		raise "unknown MDS type: #{type}"
	end

	return klass, expr
end