Class: Rack::PageCaching::Environment
- Inherits:
-
Object
- Object
- Rack::PageCaching::Environment
- Defined in:
- lib/rack/page_caching/environment.rb
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #include_hostname? ⇒ Boolean
-
#initialize(options = {}) ⇒ Environment
constructor
A new instance of Environment.
- #instrument(name, path) ⇒ Object
- #page_cache_compression ⇒ Object
- #page_cache_directory ⇒ Object
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 = set_defaults end |
Instance Method Details
#enabled? ⇒ Boolean
21 22 23 |
# File 'lib/rack/page_caching/environment.rb', line 21 def enabled? @options[:enable] end |
#include_hostname? ⇒ 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_compression ⇒ Object
9 10 11 |
# File 'lib/rack/page_caching/environment.rb', line 9 def page_cache_compression @options[:page_cache_compression] end |
#page_cache_directory ⇒ Object
13 14 15 |
# File 'lib/rack/page_caching/environment.rb', line 13 def page_cache_directory @options[:page_cache_directory] end |