Skip to content

Commit

Permalink
Update constructor to set defaults in a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkWiiPlayer committed Nov 7, 2019
1 parent b7a8610 commit a83a5af
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/resty/tarantool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 195,12 @@ function M.new(self, params)
-- Create an object using the defaults.
-- tarc = tarantool connection.
local tarc = {
host = defaults.host,
port = defaults.port,
user = defaults.user,
password = defaults.password,
socket_timeout = defaults.socket_timeout,
-- If true it sends a custom header with the tarantool version.
show_version_header = true,
call_semantics = defaults.call_semantics,
}
for key, value in pairs(defaults) do
tarc[key] = value
end
-- Loop over the given parameters and assign the values accordingly.
if params and type(params) == 'table' then
for key, value in pairs(params) do
Expand Down

0 comments on commit a83a5af

Please sign in to comment.