jlsync (owner)

Revisions

gist: 86039 Download_button fork
public
Public Clone URL: git://gist.github.com/86039.git
Embed All Files: show embed
SOR Tutorial - the 404s - blocks #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Configuration
  attr_accessor :tail_logs, :max_connections, :admin_password, :app_server
 
  class AppServer
    attr_accessor :port, :admin_password
  end
 
  def initialize
    @app_server = AppServer.new
  end
 
  def app_server(&block)
    if block_given?
      block.call(@app_server)
    else
      @app_server
    end
  end
end
 
 
def configure(&block)
  config = Configuration.new
  block.call(config)
  config
end
 
 
configuration = configure do |config|
  config.tail_logs = true
  config.max_connections = 55
  config.admin_password = 'secret'
  config.app_server do |app_server_config|
    app_server_config.port = 8808
    app_server_config.admin_password = config.admin_password
  end
end
 
configuration.class # => Configuration
configuration.tail_logs # => true
configuration.app_server.admin_password # => 'secret'