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:
parent
d3531e8d2b
commit
fb562d5c5f
|
@ -1,24 +1,27 @@
|
|||
module Rubella
|
||||
|
||||
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
|
||||
self.input_json
|
||||
else
|
||||
raise NotImplementedError, "Not supported input type "+input+" given"
|
||||
raise NotImplementedError, "Not supported input type "+input_name+" given"
|
||||
end
|
||||
|
||||
case output
|
||||
@output = case output_name
|
||||
when "image" then
|
||||
self.output_image
|
||||
else
|
||||
raise NotImplementedError, "Not supported output type "+output+" given"
|
||||
raise NotImplementedError, "Not supported output type "+output_name+" given"
|
||||
end
|
||||
|
||||
case weighting
|
||||
@weighting = case weighting_name
|
||||
when "per_value" then
|
||||
self.weighting_per_value
|
||||
when "per_overall_load" then
|
||||
|
@ -26,29 +29,34 @@ module Rubella
|
|||
when "expotential" then
|
||||
self.weighting_expotential
|
||||
else
|
||||
raise NotImplementedError, "Not supported weighting type "+weighting+" given"
|
||||
raise NotImplementedError, "Not supported weighting type "+weighting_name+" given"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def input_json
|
||||
require "rubella/input/json"
|
||||
Input::JSON
|
||||
end
|
||||
|
||||
def output_image
|
||||
require "rubella/output/image"
|
||||
Output::Image
|
||||
end
|
||||
|
||||
def weighting_per_value
|
||||
require "rubella/weighting/per_value"
|
||||
Weighting::PerValue
|
||||
end
|
||||
|
||||
def weighting_per_overall_load
|
||||
require "rubella/weighting/per_overall_load"
|
||||
Weighting::PerOverallLoad
|
||||
end
|
||||
|
||||
def weighting_expotential
|
||||
require "rubella/weighting/expotential"
|
||||
Weighting::Expotential
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
module Rubella
|
||||
module Output
|
||||
|
||||
class Image
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
module Rubella
|
||||
module Weighting
|
||||
|
||||
class Expotential
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
module Rubella
|
||||
module Weighting
|
||||
|
||||
class PerOverallLoad
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
module Rubella
|
||||
module Weigthing
|
||||
module Weighting
|
||||
|
||||
# Gets an input object and prepares the data for the output.
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue