Module: Representable::Cache::ClassMethods

Defined in:
lib/representable/cache.rb

Instance Method Summary collapse

Instance Method Details

#extended(base) ⇒ Object

DCI



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/representable/cache.rb', line 56

def extended(base)
  super(base)
  base.instance_eval do
    def representable_cache_options
      @representable_cache_options
    end
    def representable_cache_options=(options)
      @representable_cache_options = options
    end
  end

  base.representable_cache_options ||= self.representable_cache_options
end

#included(base) ⇒ Object

inherited representable



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/representable/cache.rb', line 71

def included(base)
  super(base)
  base.instance_eval do
    def representable_cache_options
      @representable_cache_options
    end
    def representable_cache_options=(options)
      @representable_cache_options = options
    end
  end
  base.representable_cache_options = self.representable_cache_options
  base.representable_cache_options[:cache_name] ||= base.name
end

#representable_cache(options = {}) ⇒ Object



85
86
87
# File 'lib/representable/cache.rb', line 85

def representable_cache(options={})
  @representable_cache_options = @representable_cache_options.merge options
end

#representable_cache_optionsObject



89
90
91
# File 'lib/representable/cache.rb', line 89

def representable_cache_options
  @representable_cache_options ||={}
end