-
-
Save le0nidas/3d1c5f8d290db0dcb98267429888bbfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GearRatios | |
def initialize(numbers, symbols) | |
@numbers = numbers | |
@symbols = symbols | |
end | |
def sum | |
@numbers.filter { |number| @symbols.any? { |symbol| number.is_next_to? symbol } } | |
.sum { |number| number.value } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment