Guest User

Untitled

a guest
Apr 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. # Get layer class from TileCache::Layers for the specified type,
  2. # raises TileCache::InvalidConfiguration if no class has been found
  3. def layer_class_for(type)
  4. class_name = type.sub(/\ALayer/, "") # once and only in the beginning
  5. raise NoSuchLayer, "Invalid layer type attribute: #{type}" unless Layers.const_defined?(class_name) # I assume we are within TileCache
  6. TileCache::Layers.const_get(class_name)
  7. end
Add Comment
Please, Sign In to add comment