Class: Alula::Hosts

Inherits:
CDN
  • Object
show all
Defined in:
lib/alula/cdns/hosts.rb

Instance Attribute Summary

Attributes inherited from CDN

#options, #site

Instance Method Summary collapse

Methods inherited from CDN

#cdns, cdns, #initialize, load, register

Constructor Details

This class inherits a constructor from Alula::CDN

Instance Method Details

#url_for(name, opts) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/alula/cdns/hosts.rb', line 3

def url_for(name, opts)
  if self.options[0] == "/"
    File.join("/", name)
  else
    host = self.options[Digest::MD5.hexdigest(name).to_i(16) % self.options.count]
    File.join(host, name)
  end
end