Class: Tarantool::Client::Configuration

Inherits:
Data
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/configuration.rb,
tarantool-client/lib/tarantool/client/configuration.rb

Overview

Immutable connection settings built from a URI and keyword options; options win.

Constant Summary collapse

UNIX_URI =
%r{\Aunix/?:}
UNIX_PATH =
%r{\Aunix/?:(?://(?=/))?(.+)\z}
EMPTY_PATH =
%r{\A/*\z}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connect_timeout ⇒ Object (readonly)

Returns the value of attribute connect_timeout

Returns:

  • (Object) —

    the current value of connect_timeout



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def connect_timeout
  @connect_timeout
end

#host ⇒ Object (readonly)

Returns the value of attribute host

Returns:

  • (Object) —

    the current value of host



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def host
  @host
end

#instrumenter ⇒ Object (readonly)

Returns the value of attribute instrumenter

Returns:

  • (Object) —

    the current value of instrumenter



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def instrumenter
  @instrumenter
end

#logger ⇒ Object (readonly)

Returns the value of attribute logger

Returns:

  • (Object) —

    the current value of logger



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def logger
  @logger
end

#max_frame_size ⇒ Object (readonly)

Returns the value of attribute max_frame_size

Returns:

  • (Object) —

    the current value of max_frame_size



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def max_frame_size
  @max_frame_size
end

#password ⇒ Object (readonly)

Returns the value of attribute password

Returns:

  • (Object) —

    the current value of password



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def password
  @password
end

#path ⇒ Object (readonly)

Returns the value of attribute path

Returns:

  • (Object) —

    the current value of path



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def path
  @path
end

#port ⇒ Object (readonly)

Returns the value of attribute port

Returns:

  • (Object) —

    the current value of port



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def port
  @port
end

#reconnect ⇒ Object (readonly)

Returns the value of attribute reconnect

Returns:

  • (Object) —

    the current value of reconnect



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def reconnect
  @reconnect
end

#reconnect_attempts ⇒ Object (readonly)

Returns the value of attribute reconnect_attempts

Returns:

  • (Object) —

    the current value of reconnect_attempts



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def reconnect_attempts
  @reconnect_attempts
end

#reconnect_delay ⇒ Object (readonly)

Returns the value of attribute reconnect_delay

Returns:

  • (Object) —

    the current value of reconnect_delay



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def reconnect_delay
  @reconnect_delay
end

#reconnect_max_delay ⇒ Object (readonly)

Returns the value of attribute reconnect_max_delay

Returns:

  • (Object) —

    the current value of reconnect_max_delay



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def reconnect_max_delay
  @reconnect_max_delay
end

#request_timeout ⇒ Object (readonly)

Returns the value of attribute request_timeout

Returns:

  • (Object) —

    the current value of request_timeout



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def request_timeout
  @request_timeout
end

#user ⇒ Object (readonly)

Returns the value of attribute user

Returns:

  • (Object) —

    the current value of user



8
9
10
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 8

def user
  @user
end

Class Method Details

.build(uri = nil, **options) ⇒ Object



13
14
15
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 13

def self.build(uri = nil, **options)
  new(**defaults, **parse_uri(uri), **options)
end

Instance Method Details

#address ⇒ Object



55
56
57
58
59
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 55

def address
  return path if path

  host.include?(':') ? "[#{host}]:#{port}" : "#{host}:#{port}"
end

#inspect ⇒ Object Also known as: to_s



61
62
63
64
65
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 61

def inspect
  fields = to_h.map { |key, value| "#{key}=#{inspect_field(key, value)}" }.join(', ')

  "#<data #{self.class.name} #{fields}>"
end

#pretty_print(printer) ⇒ Object



68
# File 'tarantool-client/lib/tarantool/client/configuration.rb', line 68

def pretty_print(printer) = printer.text(inspect)