From 9209beb012027631a5d344615349d225a497ffee Mon Sep 17 00:00:00 2001 From: Stormwind Date: Tue, 17 Feb 2015 23:01:49 +0100 Subject: [PATCH] Make it almost possible to decide input, output and weighting later It is not possible to choose something differen, if it's nil. But you can choose nil. --- lib/rubella.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/rubella.rb b/lib/rubella.rb index 5e7c84d..c19b694 100644 --- a/lib/rubella.rb +++ b/lib/rubella.rb @@ -7,21 +7,33 @@ module Rubella def initialize(input_name, output_name, weighting_name) + # set the input type @input = case input_name + # add the option to set input later + when nil then + nil when "json" then self.input_json else raise NotImplementedError, "Not supported input type "+input_name+" given" end + # set the output type @output = case output_name + # add the option to set the output later + when nil then + nil when "image" then self.output_image else raise NotImplementedError, "Not supported output type "+output_name+" given" end + # set the weighting @weighting = case weighting_name + # add the option to set the weighting later + when nil then + nil when "per_value" then self.weighting_per_value when "per_overall_load" then