Included Modules

Files

RConfig::Cascade

Public Instance Methods

overlay=(value) click to toggle source

Sets a custome overlay for

    # File lib/rconfig/cascade.rb, line 7
 7:     def overlay=(value)
 8:       reload(false) if self.overlay != value
 9:       self.overlay = value && value.dup.freeze
10:     end
suffixes_for(name) click to toggle source

Returns a list of suffixes to try for a given config name.

A config name with an explicit overlay (e.g.: ‘name_GB’) overrides any current _overlay.

This allows code to specifically ask for config overlays for a particular locale.

    # File lib/rconfig/cascade.rb, line 21
21:     def suffixes_for(name)
22:       name = name.to_s
23:       self.suffixes[name] ||= begin
24:         ol = overlay
25:         name_x = name.dup
26:         if name_x.sub!(/_([A-Z]+)$/, '')
27:           ol = $1
28:         end
29:         name_x.freeze
30:         result = if ol
31:           ol_ = ol.upcase
32:           ol = ol.downcase
33:           x = []
34:           SUFFIXES.each do |suffix|
35:             # Standard, no overlay:
36:             # e.g.: database_<suffix>.yml
37:             x << suffix
38: 
39:             # Overlay:
40:             # e.g.: database_(US|GB)_<suffix>.yml
41:             x << [ol_, suffix]
42:           end
43:           [name_x, x.freeze]
44:         else
45:           [name.dup.freeze, SUFFIXES.freeze]
46:         end
47:         result.freeze
48: 
49:         logger.debug "suffixes(#{name}) => #{result.inspect}"
50: 
51:         result
52:       end
53:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.