Module: Travlrmap::Gallery

Defined in:
lib/travlrmap/gallery.rb,
lib/travlrmap/gallery/flickr.rb

Defined Under Namespace

Classes: Flickr

Class Method Summary collapse

Class Method Details



4
5
6
7
8
9
# File 'lib/travlrmap/gallery.rb', line 4

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

.url_from_spec(spec) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/travlrmap/gallery.rb', line 11

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