Module: Rtml::Controller::CacheHelpers

Defined in:
lib/rtml/controller/cache_helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



20
21
22
23
24
25
# File 'lib/rtml/controller/cache_helpers.rb', line 20

def self.included(base)
  base.send(:extend, self)
  base.instance_eval do
    hide_action :expires_at
  end
end

Instance Method Details

#expires_at(val = nil, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rtml/controller/cache_helpers.rb', line 2

def expires_at(val = nil, &block)
  if val
    @expires_at = proc { val }
  else
    @expires_at = block if block_given?
  end

  if @expires_at
    @expires_at
  else
    if self.class.respond_to?(:expires_at)
      self.class.expires_at
    else
      nil
    end
  end
end