Class: LocalCDN::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



5
6
7
8
9
10
11
# File 'lib/config.rb', line 5

def initialize
  @urls = {}
  @urls[:remote] = YAML.load_file(file_path(:remote))
  if File.exist?(f = file_path(:local))
    @urls[:local] = YAML.load_file(f)
  end
end

Instance Attribute Details

#urlsObject (readonly)

Returns the value of attribute urls.



3
4
5
# File 'lib/config.rb', line 3

def urls
  @urls
end

Instance Method Details

#file_path(local_or_remote) ⇒ Object



13
14
15
# File 'lib/config.rb', line 13

def file_path(local_or_remote)
  File.join Rails.root, "config", "cdn.#{local_or_remote}.yml"
end