Class: Alula::CDN
- Inherits:
-
Object
- Object
- Alula::CDN
- Defined in:
- lib/alula/cdn.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Class Method Summary collapse
Instance Method Summary collapse
- #cdns ⇒ Object
-
#initialize(options, opts) ⇒ CDN
constructor
A new instance of CDN.
Constructor Details
#initialize(options, opts) ⇒ CDN
Returns a new instance of CDN.
23 24 25 26 |
# File 'lib/alula/cdn.rb', line 23 def initialize(, opts) @site = opts.delete(:site) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/alula/cdn.rb', line 21 def @options end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
20 21 22 |
# File 'lib/alula/cdn.rb', line 20 def site @site end |
Class Method Details
.cdns ⇒ Object
4 |
# File 'lib/alula/cdn.rb', line 4 def self.cdns; @@cdns ||= {}; end |
.load(opts) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/alula/cdn.rb', line 7 def self.load(opts) site = opts[:site] # Check if we have environment related site.config.cdn.reverse_each do |cdn, opts| if cdns.has_key?(cdn) return cdns[cdn].new(opts, site: site) end end raise "Cannot find CDN Provider(s): #{site.config.cdn.keys}" end |
.register(name, klass) ⇒ Object
3 |
# File 'lib/alula/cdn.rb', line 3 def self.register(name, klass); cdns[name.to_s] = klass; end |
Instance Method Details
#cdns ⇒ Object
5 |
# File 'lib/alula/cdn.rb', line 5 def cdns; self.class.cdns; end |