Class: Harmoniser::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/harmoniser/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
# File 'lib/harmoniser/configuration.rb', line 13

def initialize
  @logger = Harmoniser.logger
  @options = Options.new(**default_options)
  set_logger_severity
  @topology = Topology.new
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



10
11
12
# File 'lib/harmoniser/configuration.rb', line 10

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/harmoniser/configuration.rb', line 10

def options
  @options
end

Instance Method Details

#connection_optsObject



20
21
22
# File 'lib/harmoniser/configuration.rb', line 20

def connection_opts
  @connection_opts ||= Connection::DEFAULT_CONNECTION_OPTS
end

#connection_opts=(opts) ⇒ Object

Raises:

  • (TypeError)


24
25
26
27
28
# File 'lib/harmoniser/configuration.rb', line 24

def connection_opts=(opts)
  raise TypeError, "opts must be a Hash object" unless opts.is_a?(Hash)

  @connection_opts = connection_opts.merge(opts)
end

#define_topology {|@topology| ... } ⇒ Object

Yields:

  • (@topology)

Raises:

  • (LocalJumpError)


30
31
32
33
34
# File 'lib/harmoniser/configuration.rb', line 30

def define_topology
  raise LocalJumpError, "A block is required for this method" unless block_given?

  yield(@topology)
end

#options_withObject



36
37
38
39
# File 'lib/harmoniser/configuration.rb', line 36

def options_with(**)
  @options = options.with(**)
  set_logger_severity
end