Skip to content

Replace if not value.nil? with unless value.nil?#299

Merged
yahonda merged 1 commit into
rsim:masterfrom
yahonda:tidy-if-not-to-unless
May 13, 2026
Merged

Replace if not value.nil? with unless value.nil?#299
yahonda merged 1 commit into
rsim:masterfrom
yahonda:tidy-if-not-to-unless

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented May 13, 2026

Summary

In add_argument's XMLTYPE branch, two adjacent trailing modifiers used the awkward double-negation form:

@assignment_sql << "l_#{argument} := XMLTYPE(:#{argument});\n" if not value.nil?
@bind_values[argument] = value if not value.nil?

Replace each with unless value.nil? — same semantics, idiomatic Ruby, same line count.

@assignment_sql << "l_#{argument} := XMLTYPE(:#{argument});\n" unless value.nil?
@bind_values[argument] = value unless value.nil?

Scope is intentionally narrow. The remaining if !x.empty? at procedure_call.rb:105 pairs with an elsif !x.empty? at line 107 where unless cannot be substituted, so it is left alone for symmetry.

Diff stat: lib/plsql/procedure_call.rb | 4 ++-- (+2 / -2, two single-line changes).

Test plan

  • bundle exec rspec — 468 examples, 0 failures, 1 pre-existing pending
  • Grep confirms no remaining if not constructs in lib/plsql/procedure_call.rb outside of a code comment that legitimately mentions "if not overloaded"

🤖 Generated with Claude Code

Two adjacent `if not value.nil?` trailing modifiers in
`add_argument`'s XMLTYPE branch used the awkward double negation
form. Replace with `unless value.nil?` for idiomatic Ruby; same
semantics, same line count.

No behavior change. Full suite is green (468 examples, 0 failures,
1 pre-existing pending).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yahonda yahonda merged commit 1af9094 into rsim:master May 13, 2026
20 checks passed
@yahonda yahonda deleted the tidy-if-not-to-unless branch May 13, 2026 02:18
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