Skip to content

Instantly share code, notes, and snippets.

@Mk-Etlinger
Last active March 8, 2018 15:04
Show Gist options
  • Save Mk-Etlinger/cbcf37199004539acd2e4200c5300d06 to your computer and use it in GitHub Desktop.
Save Mk-Etlinger/cbcf37199004539acd2e4200c5300d06 to your computer and use it in GitHub Desktop.
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