Module: BennyCache::Base

Defined in:
lib/benny_cache/base.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



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

def self.included(base) #:nodoc:
  base.extend(BennyCache::Base::ClassMethods)
end

Instance Method Details

#benny_constantize(string) ⇒ Object

:nodoc:



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/benny_cache/base.rb', line 7

def benny_constantize(string) #:nodoc:
  if string.respond_to?(:constantize)
    # use ActiveSupport directly if possible
    string.constantize
  else
    names = string.split('::')
    names.shift if names.empty? || names.first.empty?
    constant = Object
    names.each do |name|
      constant = constant.const_get(name)
    end
    constant
  end
end