Skip to content

refactor(configuration): use node[attr] in node_missing_parameters? - #65

Open
erimicel wants to merge 1 commit into
typesense:masterfrom
OLIOEX:simplify-node-missing-parameters
Open

erimicel wants to merge 1 commit into
typesense:masterfrom
OLIOEX:simplify-node-missing-parameters

Conversation

@erimicel

Copy link
Copy Markdown
Contributor

Replaces node.send(:[], attr) with node[attr] in Configuration#node_missing_parameters?. node is a Hash, so the behaviour is the same with less indirection. Split out from #60.

%i[protocol host port].any? { |attr| node.send(:[], attr).nil? }
# →
%i[protocol host port].any? { |attr| node[attr].nil? }

Verification

  • bundle exec rspec spec/typesense/configuration_spec.rb: 5 examples, 0 failures. These include the missing protocol/host/port cases.
  • bundle exec rubocop lib/typesense/configuration.rb: no offenses.

PR Checklist

node is a Hash, so node.send(:[], attr) and node[attr] behave the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant