0
0
Fork 0

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.
This commit is contained in:
Stormwind 2015-02-17 23:01:49 +01:00
parent fb562d5c5f
commit 9209beb012
1 changed files with 12 additions and 0 deletions

View File

@ -7,21 +7,33 @@ module Rubella
def initialize(input_name, output_name, weighting_name) def initialize(input_name, output_name, weighting_name)
# set the input type
@input = case input_name @input = case input_name
# add the option to set input later
when nil then
nil
when "json" then when "json" then
self.input_json self.input_json
else else
raise NotImplementedError, "Not supported input type "+input_name+" given" raise NotImplementedError, "Not supported input type "+input_name+" given"
end end
# set the output type
@output = case output_name @output = case output_name
# add the option to set the output later
when nil then
nil
when "image" then when "image" then
self.output_image self.output_image
else else
raise NotImplementedError, "Not supported output type "+output_name+" given" raise NotImplementedError, "Not supported output type "+output_name+" given"
end end
# set the weighting
@weighting = case weighting_name @weighting = case weighting_name
# add the option to set the weighting later
when nil then
nil
when "per_value" then when "per_value" then
self.weighting_per_value self.weighting_per_value
when "per_overall_load" then when "per_overall_load" then