Class: Rack::PageCaching::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/page_caching/environment.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Environment

Returns a new instance of Environment.



4
5
6
7
# File 'lib/rack/page_caching/environment.rb', line 4

def initialize(options = {})
  @options = options
  set_defaults
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rack/page_caching/environment.rb', line 21

def enabled?
  @options[:enable]
end

#include_hostname?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rack/page_caching/environment.rb', line 17

def include_hostname?
  @options[:include_hostname]
end

#instrument(name, path) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rack/page_caching/environment.rb', line 25

def instrument(name, path)
  if defined? ActiveSupport::Notifications
    ActiveSupport::Notifications.instrument("#{name}.action_controller", path: path) do
      yield
    end
  else
    yield
  end
end

#page_cache_compressionObject



9
10
11
# File 'lib/rack/page_caching/environment.rb', line 9

def page_cache_compression
  @options[:page_cache_compression]
end

#page_cache_directoryObject



13
14
15
# File 'lib/rack/page_caching/environment.rb', line 13

def page_cache_directory
  @options[:page_cache_directory]
end