Class: Pokotarou::Operator
- Inherits:
-
Object
- Object
- Pokotarou::Operator
- Defined in:
- lib/pokotarou/operator.rb
Defined Under Namespace
Classes: NotFoundLoader
Class Method Summary collapse
- .execute(input) ⇒ Object
- .gen_config(filepath) ⇒ Object
- .import(filepath) ⇒ Object
- .pipeline_execute(input_arr) ⇒ Object
- .reset ⇒ Object
- .set_args(hash) ⇒ Object
Class Method Details
.execute(input) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pokotarou/operator.rb', line 13 def execute input AdditionalMethods::Main.init() # if input is filepath, generate config_data return_val = if input.kind_of?(String) SeedDataRegister::Main.register(gen_config(input)) else SeedDataRegister::Main.register(input) end AdditionalMethods::Main.remove_filepathes_from_yml() return_val end |
.gen_config(filepath) ⇒ Object
73 74 75 |
# File 'lib/pokotarou/operator.rb', line 73 def gen_config filepath RegistrationConfigMaker::Main.gen(filepath) end |
.import(filepath) ⇒ Object
57 58 59 60 |
# File 'lib/pokotarou/operator.rb', line 57 def import filepath AdditionalMethods::Main.init() AdditionalMethods::Main.import(filepath) end |
.pipeline_execute(input_arr) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pokotarou/operator.rb', line 29 def pipeline_execute input_arr AdditionalMethods::Main.init() return_vals = [] input_arr.each do |e| handler = HandlerFactory.gen_handler_with_cache(e[:filepath]) if e[:change_data].present? e[:change_data].each do |block, config| config.each do |model, seed| seed.each do |col_name, val| handler.change_seed(block, model, col_name, val) end end end end e[:args] ||= {} e[:args][:passed_return_val] = return_vals.last set_args(e[:args]) return_vals << Pokotarou.execute(handler.get_data()) AdditionalMethods::Main.remove_filepathes_from_yml() end return_vals end |
.reset ⇒ Object
66 67 68 69 70 71 |
# File 'lib/pokotarou/operator.rb', line 66 def reset AdditionalMethods::Main.remove() AdditionalArguments::Main.remove() AdditionalVariables::Main.remove() @handler_chache = {} end |
.set_args(hash) ⇒ Object
62 63 64 |
# File 'lib/pokotarou/operator.rb', line 62 def set_args hash AdditionalArguments::Main.import(hash) end |