Method: Java::NetSfEhcacheConfig::Configuration.find

Defined in:
lib/ehcache/config.rb

.find(*dirs) ⇒ Object

Searches for an Ehcache configuration file and, if found, returns a Configuration object created from it. The search algorithm looks for files named “ehcache.yml” or “ehcache.xml”, first looking in the provided directories in order, and if not found there then looking in the Ruby $LOAD_PATH. Returns nil if no configuration file is found.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ehcache/config.rb', line 14

def self.find(*dirs)
  file_names = %w[ehcache.yml ehcache.xml]
  dirs += $LOAD_PATH
  dirs.each do |dir|
    file_names.each do |name|
      candidate = File.join(dir, name)
      return create(candidate) if File.exist?(candidate)
    end
  end
  nil
end