Skip to content

Conversation

@cardmagic
Copy link
Owner

Summary

Replace legacy inject patterns with modern Ruby .sum method.

Changes

# Before
proximity_array_for_content(x).inject(0.0) { |i, j| i + j[1] }
votes.values.inject(0.0) { |sum, v| sum + v }

# After
proximity_array_for_content(x).sum { |pair| pair[1] }
votes.values.sum

Benefits

  • Cleaner, more idiomatic Ruby
  • Native implementation (slightly better performance)

Fixes #71

Replace legacy inject patterns with modern Ruby .sum method:
- LSI#highest_relative_content
- LSI#classify_with_confidence

Fixes #71
@cardmagic cardmagic merged commit 870fef3 into master Dec 27, 2025
5 checks passed
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.

Modernize Ruby idioms: use .sum instead of inject

2 participants