Last active
March 8, 2018 15:04
-
-
Save Mk-Etlinger/cbcf37199004539acd2e4200c5300d06 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ExpressionEvaluator | |
def self.parse(string) | |
complex_exps = string.scan(/-\s\d+\s\d+/) | |
simple_exps = string.gsub(/-\s\d+\s\d+/, '') | |
complex_sum(complex_exps) + simple_sum(simple_exps) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment