Class: Serve::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/serve/rails/configuration.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/serve/rails/configuration.rb', line 6

def initialize
  Serve::ResponseCache.defaults.update(
    :logger => ActionController::Base.logger,
    :perform_caching => ActionController::Base.perform_caching
  )
  
  @mounts = []
  
  define_find_cache do |request|
    @default_cache ||= Serve::ResponseCache.new(
      :directory => File.join(::Rails.root, 'tmp', 'serve_cache')
    )
  end
end

Instance Attribute Details

#mountsObject (readonly)

Returns the value of attribute mounts.



4
5
6
# File 'lib/serve/rails/configuration.rb', line 4

def mounts
  @mounts
end

#view_helpersObject (readonly)

Returns the value of attribute view_helpers.



4
5
6
# File 'lib/serve/rails/configuration.rb', line 4

def view_helpers
  @view_helpers
end

Instance Method Details

#define_find_cache(&block) ⇒ Object



21
22
23
24
25
# File 'lib/serve/rails/configuration.rb', line 21

def define_find_cache(&block)
  metaclass.module_eval do
    define_method :find_cache, &block
  end
end

#mount(route, root_path) {|m| ... } ⇒ Object

Yields:

  • (m)


27
28
29
30
31
32
# File 'lib/serve/rails/configuration.rb', line 27

def mount(route, root_path)
  m = Mount.new(route, root_path)
  @mounts << m
  yield m if block_given?
  m
end