Sha256: 560d452d842810cbfb0a5add0754bf4f968a13f35efd2eb83ec60b1aa49b1385

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

# encoding: utf-8
module Travlrmap
  module Gallery
    def self.gallery_type(type)
      require 'travlrmap/gallery/%s' % type.downcase
      self.const_get(type.capitalize)
    rescue LoadError
      raise "Unknown gallery type %s" % type
    end

    def self.url_from_spec(spec)
      if spec =~ /^(.+?),(.+)$/
        type = $1.capitalize
        options = $2

        options = Hash[options.split(",").map{|i| i.split("=")}]

        gallery_type(type).url_from_spec(options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
travlrmap-1.5.2 lib/travlrmap/gallery.rb
travlrmap-1.5.1 lib/travlrmap/gallery.rb
travlrmap-1.5.0 lib/travlrmap/gallery.rb