Class: Tarantool::Rails::Configuration
- Inherits:
-
Data
- Object
- Data
- Tarantool::Rails::Configuration
- Defined in:
- tarantool-rails/lib/tarantool/rails/configuration.rb,
tarantool-rails/lib/tarantool/rails/configuration.rb
Overview
Builds a Configuration from the Hash config_for returns.
Constant Summary collapse
- CLIENT_KEYS =
%i[user password connect_timeout request_timeout reconnect reconnect_attempts reconnect_delay reconnect_max_delay max_frame_size].freeze
- KEYS =
(CLIENT_KEYS + %i[addresses address read write storage crud admin_uri]).freeze
- CRUD_KEYS =
%i[primary_index read write timeout_margin].freeze
- STORAGES =
%i[box crud].freeze
- URI_PASSWORD =
%r{:[^:@/]*@}
Instance Attribute Summary collapse
-
#addresses ⇒ Object
readonly
Returns the value of attribute addresses.
-
#admin_uri ⇒ Object
readonly
Returns the value of attribute admin_uri.
-
#client_options ⇒ Object
readonly
Returns the value of attribute client_options.
-
#crud ⇒ Object
readonly
Returns the value of attribute crud.
-
#read ⇒ Object
readonly
Returns the value of attribute read.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
-
#write ⇒ Object
readonly
Returns the value of attribute write.
Class Method Summary collapse
Instance Method Summary collapse
- #inspect ⇒ Object (also: #to_s)
Instance Attribute Details
#addresses ⇒ Object (readonly)
Returns the value of attribute addresses
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def addresses @addresses end |
#admin_uri ⇒ Object (readonly)
Returns the value of attribute admin_uri
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def admin_uri @admin_uri end |
#client_options ⇒ Object (readonly)
Returns the value of attribute client_options
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def @client_options end |
#crud ⇒ Object (readonly)
Returns the value of attribute crud
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def crud @crud end |
#read ⇒ Object (readonly)
Returns the value of attribute read
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def read @read end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def storage @storage end |
#write ⇒ Object (readonly)
Returns the value of attribute write
7 8 9 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 7 def write @write end |
Class Method Details
.from_hash(hash) ⇒ Object
36 37 38 39 40 41 42 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 36 def from_hash(hash) hash = checked(hash.to_h.transform_keys(&:to_sym)) new(addresses: addresses(hash), client_options: hash.slice(*CLIENT_KEYS), storage: storage(hash[:storage]), read: (hash[:read]), write: (hash[:write]), crud: crud(hash[:crud]), admin_uri: hash[:admin_uri]) end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
8 9 10 11 12 |
# File 'tarantool-rails/lib/tarantool/rails/configuration.rb', line 8 def inspect fields = to_h.map { |key, value| "#{key}=#{filtered(key, value).inspect}" }.join(', ') "#<data #{self.class.name} #{fields}>" end |