Class: Rubcask::Server::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubcask/server/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
21
22
23
24
# File 'lib/rubcask/server/config.rb', line 17

def initialize
  self.hostname = "localhost"
  self.timeout = nil
  self.keepalive = true
  self.port = 8080

  yield(self) if block_given?
end

Instance Attribute Details

#hostnameString

Returns Hostname of the server.

Returns:

  • (String)

    Hostname of the server



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubcask/server/config.rb', line 16

Config = Struct.new(:hostname, :port, :timeout, :keepalive) do
  def initialize
    self.hostname = "localhost"
    self.timeout = nil
    self.keepalive = true
    self.port = 8080

    yield(self) if block_given?
  end

  def self.configure(&block)
    new(&block).freeze
  end
end

#keepaliveboolean

Returns Flag whether to set TCP’s keepalive.

Returns:

  • (boolean)

    Flag whether to set TCP’s keepalive



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubcask/server/config.rb', line 16

Config = Struct.new(:hostname, :port, :timeout, :keepalive) do
  def initialize
    self.hostname = "localhost"
    self.timeout = nil
    self.keepalive = true
    self.port = 8080

    yield(self) if block_given?
  end

  def self.configure(&block)
    new(&block).freeze
  end
end

#portInteger

Returns Port of the server.

Returns:

  • (Integer)

    Port of the server



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubcask/server/config.rb', line 16

Config = Struct.new(:hostname, :port, :timeout, :keepalive) do
  def initialize
    self.hostname = "localhost"
    self.timeout = nil
    self.keepalive = true
    self.port = 8080

    yield(self) if block_given?
  end

  def self.configure(&block)
    new(&block).freeze
  end
end

#timeoutInteger

Timeut of the server

If the client does not send any messages for provided number of seconds the connection with it s closed

Returns:

  • (Integer)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubcask/server/config.rb', line 16

Config = Struct.new(:hostname, :port, :timeout, :keepalive) do
  def initialize
    self.hostname = "localhost"
    self.timeout = nil
    self.keepalive = true
    self.port = 8080

    yield(self) if block_given?
  end

  def self.configure(&block)
    new(&block).freeze
  end
end

Class Method Details

.configure(&block) ⇒ Object



26
27
28
# File 'lib/rubcask/server/config.rb', line 26

def self.configure(&block)
  new(&block).freeze
end