Top Level Namespace

Defined Under Namespace

Modules: ActiveSupport, Ehcache Classes: Array

Constant Summary collapse

EHCACHE_LIBS_DIR =
"#{Ehcache::EHCACHE_HOME}/ext"

Instance Method Summary collapse

Instance Method Details

#process_init_args(*args) ⇒ Object

Helper method for processing initialization arguments passed to CacheManager.create and CacheManager#initialize.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ehcache/cache_manager.rb', line 52

def process_init_args(*args)
  args.compact!
  if args.empty?
    # First, look relative to the file that is creating the CacheManager.
    # The expression caller[1] finds the entry in the call stack where
    # CacheManager.new or CacheManager.create was called.
    creator = /^\s*(.+?):\d/.match(caller[1])[1]
    if ehcache_config = Java::NetSfEhcacheConfig::Configuration.find(File.dirname(creator))
      yield(ehcache_config)
    else
      yield
    end
  elsif args.size == 1 && args.first.is_a?(String)
    yield(Ehcache::Config::Configuration.create(args.first))
  else
    yield(*args)
  end
end