Module: Representable::Cache::ClassMethods

Defined in:
lib/representable/cache.rb

Instance Method Summary collapse

Instance Method Details

#extended(base) ⇒ Object

DCI



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/representable/cache.rb', line 46

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



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/representable/cache.rb', line 61

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



75
76
77
# File 'lib/representable/cache.rb', line 75

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

#representable_cache_optionsObject



79
80
81
# File 'lib/representable/cache.rb', line 79

def representable_cache_options
  @representable_cache_options ||={}
end