Skip to content

Instantly share code, notes, and snippets.

@rusilko
Last active April 11, 2016 08:49
Show Gist options
  • Save rusilko/18c2d8e97ce12fe9547c to your computer and use it in GitHub Desktop.
Save rusilko/18c2d8e97ce12fe9547c to your computer and use it in GitHub Desktop.
class Evaluate
def call(input_data, bank)
initial_data = input_data.merge(bank.parameters)
steps = bank.evaluation_steps
steps.inject(initial_data) do |data, (result_name, calculate_result)|
data.merge({ result_name.to_sym => calculate_result.(data) })
end
end
end
# call it
Evaluate.new.(RAW_INPUT, BankA.new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment