Class: Linr::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/linr/config.rb

Overview

Holds the config of a Client

Examples:

Config.new(host: "db.domain.com", logger: Logger.new($stdout))

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

Build a config based on opts

Parameters:

  • opts (Hash) (defaults to: {})

    the options to create the config

Options Hash (opts):

  • :host (String)
  • :port (Fixnum)
  • :logger (::Logger)
  • :encoder (Object)

17
18
19
20
21
22
# File 'lib/linr/config.rb', line 17

def initialize(opts = {})
  @host    = opts.fetch(:host, "127.0.0.1")
  @port    = opts.fetch(:port, 8089)
  @logger  = opts.fetch(:logger, Logger::Null.new)
  @encoder = opts.fetch(:encoder, Encoder::Line.new)
end

Instance Attribute Details

#encoderObject (readonly)

Returns the value of attribute encoder


9
10
11
# File 'lib/linr/config.rb', line 9

def encoder
  @encoder
end

#hostObject (readonly)

Returns the value of attribute host


6
7
8
# File 'lib/linr/config.rb', line 6

def host
  @host
end

#loggerObject (readonly)

Returns the value of attribute logger


8
9
10
# File 'lib/linr/config.rb', line 8

def logger
  @logger
end

#portObject (readonly)

Returns the value of attribute port


7
8
9
# File 'lib/linr/config.rb', line 7

def port
  @port
end