Class: Plum::Rack::DSL::Config
- Inherits:
-
Object
- Object
- Plum::Rack::DSL::Config
- Defined in:
- lib/plum/rack/dsl.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #debug(bool) ⇒ Object
- #fallback_legacy(str) ⇒ Object
- #group(groupname) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #listener(type, conf) ⇒ Object
- #log(out) ⇒ Object
- #server_push(bool) ⇒ Object
- #threaded(bool) ⇒ Object
- #threadpool_size(int) ⇒ Object
- #user(username) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
8 9 10 |
# File 'lib/plum/rack/dsl.rb', line 8 def initialize @config = ::Plum::Rack::Config::DEFAULT_CONFIG.dup end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/plum/rack/dsl.rb', line 6 def config @config end |
Instance Method Details
#debug(bool) ⇒ Object
20 21 22 |
# File 'lib/plum/rack/dsl.rb', line 20 def debug(bool) @config[:debug] = !!bool end |
#fallback_legacy(str) ⇒ Object
51 52 53 54 55 |
# File 'lib/plum/rack/dsl.rb', line 51 def fallback_legacy(str) h, p = str.split(":") @config[:fallback_legacy_host] = h @config[:fallback_legacy_port] = p.to_i end |
#group(groupname) ⇒ Object
61 62 63 |
# File 'lib/plum/rack/dsl.rb', line 61 def group(groupname) @config[:group] = groupname end |
#listener(type, conf) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/plum/rack/dsl.rb', line 24 def listener(type, conf) case type when :unix lc = conf.merge(listener: UNIXListener) when :tcp lc = conf.merge(listener: TCPListener) when :tls lc = conf.merge(listener: TLSListener) else raise "Unknown listener type: #{type} (known type: :unix, :http, :https)" end @config[:listeners] << lc end |
#log(out) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/plum/rack/dsl.rb', line 12 def log(out) if out.is_a?(String) @config[:log] = File.open(out, "a") else @config[:log] = out end end |
#server_push(bool) ⇒ Object
39 40 41 |
# File 'lib/plum/rack/dsl.rb', line 39 def server_push(bool) @config[:server_push] = !!bool end |
#threaded(bool) ⇒ Object
43 44 45 |
# File 'lib/plum/rack/dsl.rb', line 43 def threaded(bool) @config[:threaded] = !!bool end |
#threadpool_size(int) ⇒ Object
47 48 49 |
# File 'lib/plum/rack/dsl.rb', line 47 def threadpool_size(int) @config[:threadpool_size] = int.to_i end |
#user(username) ⇒ Object
57 58 59 |
# File 'lib/plum/rack/dsl.rb', line 57 def user(username) @config[:user] = username end |