Class: CodeRunner::Merged

Inherits:
CodeRunner show all
Includes:
Enumerable
Defined in:
lib/coderunner/merged_code_runner.rb

Constant Summary

Constants inherited from CodeRunner

CLASS_OPTIONS, CLF, CLF_BOOLS, CLF_INVERSE_BOOLS, CLF_TO_LONG, CLF_TO_SHORT_COPTS, CODE_COMMAND_OPTIONS, CODE_OPTIONS, CODE_RUNNER_VERSION, COMMANDS, COMMANDS_WITH_HELP, COMMAND_FOLDER, COMMAND_LINE_FLAGS_WITH_HELP, DEFAULT_COMMAND_OPTIONS, DEFAULT_RUNNER_OPTIONS, FOLDER_DEFAULTS, GLOBAL_BINDING, GLOBAL_OPTIONS, GraphKit, LONG_COMMAND_LINE_FLAGS, LONG_COMMAND_LINE_OPTIONS, LONG_TO_SHORT, NECESSARY_RUN_CLASS_PROPERTIES, NECESSARY_RUN_CODE_METHODS, NECESSARY_RUN_SYSTEM_METHODS, PERMITTED_STATI, SCRIPT_FOLDER, SETUP_RUN_CLASSES, SUBMIT_OPTIONS, SYS, SYSTEM_MODULE

Instance Attribute Summary

Attributes inherited from CodeRunner

#cache, #cmaxes, #cmins, #code, #combined_ids, #combined_run_list, #current_request, #current_status, #defaults_file, #executable, #ids, #max_id, #maxes, #mins, #modlet, #phantom_ids, #phantom_run_list, #print_out_size, #requests, #root_folder, #run_class, #run_list, #start_id

Instance Method Summary collapse

Methods inherited from CodeRunner

#add_phantom_run, #alter_ids, available_defaults_files, available_modlets, #axiskit, cancel, #cancel_job, code_command, #code_run_environment, code_runner_execute, #continue_in_new_folder, continue_in_new_folder, #create_archive, delete, #destroy, differences_between, directory, dumb_film, #dup, #executable_location, #executable_name, execute, fetch_runner, film, #film_graphkit, film_graphkit_frame_array, #film_run_graphkit, #filter, #filtered_ids, #generate_combined_ids, generate_cubecalc, generate_documentation, #get_all_root_folder_contents, #get_max, #get_min, #get_run_class, get_run_class_name, #get_run_class_name, gets, #gets, #graphkit, #graphkit_from_lists, #graphkit_from_lists_with_frame_array, graphkit_multiple_runners, graphkit_multiple_runners_with_frame_array, #graphkit_shorthand, #increment_max_id, interactive_mode, #job_identifier, launcher_directory, load_file, #make_film_from_lists, make_film_multiple_runners, make_film_multiple_runners_old, manual, #marshalled_variables, #merge, netcdf_plot, #new_run, old_get_run_class_name, #p, parameter_scan, #parameter_scan, plot_graph, #print, #print_out, print_queue_status, process_command_line_option, process_command_options, #puts, #rcp, read_default_command_options, #read_defaults, #read_folder_defaults, #readout, readout, #readout_cols, recheck, #recheck_filtered_runs, #recheck_incomplete_runs, reference, repair_marshal_run_class_not_found_error, #respond_to_requests, resubmit, run_class, run_command, #run_graphkit, #run_graphkit_shorthand, run_script, runner, runner_eval, #runs, #save_all, #save_large_cache, scan, server_dump, #server_dump, set_class_defaults, set_default_command_options_from_command_line, set_runner_defaults, #set_start_id, setup_run_class, #setup_run_class, show_values_of, #similar_runs, #simple_scan, #sort_runs, start_launcher, status, status_loop, status_with_comments, #submit, submit, submit_command, #sweep_graphkits, #update, update_runners, #write_data, write_graph

Constructor Details

#initialize(*runners) ⇒ Merged

Returns a new instance of Merged.



16
17
18
19
20
21
22
23
24
# File 'lib/coderunner/merged_code_runner.rb', line 16

def initialize(*runners)
	@runners = []
	r = runners[0]
	r.instance_variables.each do |v| 
		instance_variable_set(v, r.instance_variable_get(v))
	end
	@run_list = {}
	runners.each{|runner| add_runner(runner)}
end

Instance Method Details

#add_runner(runner) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/coderunner/merged_code_runner.rb', line 25

def add_runner(runner)
	@runners.push runner
	runner.run_list.each do |id, run|
		#raise "Duplicate ids: #{id}" if @run_list[id]
		@run_list[id] = run
	end
	@ids = @run_list.keys
end

#eachObject



12
13
14
# File 'lib/coderunner/merged_code_runner.rb', line 12

def each
	@runners.each{|r| yield(r)}
end

#merge_method(meth, *args, &block) ⇒ Object



33
34
35
36
# File 'lib/coderunner/merged_code_runner.rb', line 33

def merge_method(meth, *args, &block)
	results = @runners.map{|r| r.send(meth, *args)}
	return results.inject{|o,n| yield(o,n)}
end