Module: CdnTags
- Defined in:
- lib/cdn_tags.rb,
lib/cdn_tags/error.rb,
lib/cdn_tags/helpers.rb,
lib/cdn_tags/version.rb,
lib/cdn_tags/configuration.rb
Defined Under Namespace
Modules: Helpers
Classes: Configuration, Error, Install
Constant Summary
collapse
- VERSION =
"0.4.1"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
6
7
8
|
# File 'lib/cdn_tags.rb', line 6
def self.configuration
@configuration ||= Configuration.new
end
|
10
11
12
13
|
# File 'lib/cdn_tags.rb', line 10
def self.configure
yield self.configuration
self.configuration.post_configure_hooks
end
|
.included(base) ⇒ Object
15
16
17
18
|
# File 'lib/cdn_tags.rb', line 15
def self.included(base)
CdnTags.configuration { |c| nil }
base.send :include, Helpers
end
|
.map_sources(sources, config_key) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/cdn_tags/helpers.rb', line 18
def self.map_sources(sources, config_key)
config = CdnTags.configuration
return sources unless config.cdn_environments.include? config.environment.to_sym
sources.map do |s|
src = config.send(config_key)[s]
if src.nil?
raise CdnTags::Error.new(config), "#{s} is not defined. Check CdnTags configuration." if config.raise_on_missing
s
else
src
end
end
end
|