0
0
Fork 0

Add saving of the to the constuctor given data

Now we'll not only load the given classes, we will use them.
This commit is contained in:
Stormwind 2015-02-17 22:28:31 +01:00
parent d3531e8d2b
commit fb562d5c5f
5 changed files with 41 additions and 9 deletions

View File

@ -1,24 +1,27 @@
module Rubella module Rubella
class Map class Map
attr_reader :input
attr_reader :output
attr_reader :weighting
def initialize(input, output, weighting) def initialize(input_name, output_name, weighting_name)
case input @input = case input_name
when "json" then when "json" then
self.input_json self.input_json
else else
raise NotImplementedError, "Not supported input type "+input+" given" raise NotImplementedError, "Not supported input type "+input_name+" given"
end end
case output @output = case output_name
when "image" then when "image" then
self.output_image self.output_image
else else
raise NotImplementedError, "Not supported output type "+output+" given" raise NotImplementedError, "Not supported output type "+output_name+" given"
end end
case weighting @weighting = case weighting_name
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
@ -26,29 +29,34 @@ module Rubella
when "expotential" then when "expotential" then
self.weighting_expotential self.weighting_expotential
else else
raise NotImplementedError, "Not supported weighting type "+weighting+" given" raise NotImplementedError, "Not supported weighting type "+weighting_name+" given"
end end
end end
def input_json def input_json
require "rubella/input/json" require "rubella/input/json"
Input::JSON
end end
def output_image def output_image
require "rubella/output/image" require "rubella/output/image"
Output::Image
end end
def weighting_per_value def weighting_per_value
require "rubella/weighting/per_value" require "rubella/weighting/per_value"
Weighting::PerValue
end end
def weighting_per_overall_load def weighting_per_overall_load
require "rubella/weighting/per_overall_load" require "rubella/weighting/per_overall_load"
Weighting::PerOverallLoad
end end
def weighting_expotential def weighting_expotential
require "rubella/weighting/expotential" require "rubella/weighting/expotential"
Weighting::Expotential
end end
end end

View File

@ -0,0 +1,8 @@
module Rubella
module Output
class Image
end
end
end

View File

@ -0,0 +1,8 @@
module Rubella
module Weighting
class Expotential
end
end
end

View File

@ -0,0 +1,8 @@
module Rubella
module Weighting
class PerOverallLoad
end
end
end

View File

@ -1,5 +1,5 @@
module Rubella module Rubella
module Weigthing module Weighting
# Gets an input object and prepares the data for the output. # Gets an input object and prepares the data for the output.
# #