Module: LS4::MDSCacheSelector
- Defined in:
- lib/ls4/service/mds_cache.rb
Constant Summary collapse
- IMPLS =
{}
Class Method Summary collapse
Class Method Details
.register(name, klass) ⇒ Object
125 126 127 128 |
# File 'lib/ls4/service/mds_cache.rb', line 125 def self.register(name, klass) IMPLS[name.to_sym] = klass nil end |
.select_class(uri) ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ls4/service/mds_cache.rb', line 130 def self.select_class(uri) if uri.empty? return NullMDSCache end if m = /^(\w{1,8})\:(.*)/.match(uri) type = m[1].to_sym expr = m[2] else type = :null expr = uri end klass = IMPLS[type] unless klass raise "unknown MDSCache type: #{type}" end return klass, expr end |