Class: Pokotarou::Operater
- Inherits:
-
Object
- Object
- Pokotarou::Operater
- Defined in:
- lib/pokotarou.rb
Defined Under Namespace
Classes: NotFoundLoader
Class Method Summary collapse
- .execute(input) ⇒ Object
- .gen_handler(filepath) ⇒ Object
- .gen_handler_with_cache(filepath) ⇒ Object
- .import(filepath) ⇒ Object
- .pipeline_execute(input_arr) ⇒ Object
- .reset ⇒ Object
- .set_args(hash) ⇒ Object
Class Method Details
.execute(input) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pokotarou.rb', line 11 def execute input init_proc() # if input is filepath, generate config_data return_val = if input.kind_of?(String) DataRegister.register(gen_config(input)) else DataRegister.register(input) end AdditionalMethods.remove_filepathes_from_yml() return_val end |
.gen_handler(filepath) ⇒ Object
72 73 74 75 76 |
# File 'lib/pokotarou.rb', line 72 def gen_handler filepath init_proc() PokotarouHandler.new(gen_config(filepath)) end |
.gen_handler_with_cache(filepath) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/pokotarou.rb', line 78 def gen_handler_with_cache filepath init_proc() @handler_cache ||= {} @handler_cache[filepath] ||= PokotarouHandler.new(gen_config(filepath)) @handler_cache[filepath].deep_dup end |
.import(filepath) ⇒ Object
55 56 57 58 59 |
# File 'lib/pokotarou.rb', line 55 def import filepath init_proc() AdditionalMethods.import(filepath) end |
.pipeline_execute(input_arr) ⇒ Object
27 28 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 |
# File 'lib/pokotarou.rb', line 27 def pipeline_execute input_arr init_proc() return_vals = [] input_arr.each do |e| handler = 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.remove_filepathes_from_yml() end return_vals end |
.reset ⇒ Object
65 66 67 68 69 70 |
# File 'lib/pokotarou.rb', line 65 def reset AdditionalMethods.remove() Arguments.remove() AdditionalVariables.remove() @handler_chache = {} end |
.set_args(hash) ⇒ Object
61 62 63 |
# File 'lib/pokotarou.rb', line 61 def set_args hash Arguments.import(hash) end |