class RBT::ChainCompile
Constants
- ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS
#¶ ↑
ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 36 def initialize( i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS, run_already = true ) reset # ======================================================================= # # === Handle blocks next # ======================================================================= # if block_given? yielded = yield case yielded when :require_compile_base require_compile_base end end menu(i) # Intercept here for the commandline arguments. set_compile_these_programs(i) run if run_already end
Public Instance Methods
compile_these_programs?()
click to toggle source
#¶ ↑
compile_these_programs?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 135 def compile_these_programs? @compile_these_programs end
Also aliased as: input?
do_compile_this_program(i)
click to toggle source
notify_the_user_which_programs_we_will_compile( i = input? )
click to toggle source
#¶ ↑
notify_the_user_which_programs_we_will_compile
¶ ↑
This method will notify the user which programs we are about to compile next.
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 145 def notify_the_user_which_programs_we_will_compile( i = input? ) n_programs = i.size.to_s opne "#{rev}We will compile these `#{sfancy(n_programs)}#{rev}` programs:" _ = simp( i.join(', ').strip ) _.chop! if _.end_with?(',') opne " #{_}" end
Also aliased as: show_compile_chain
require_compile_base()
click to toggle source
#¶ ↑
require_compile_base
¶ ↑
We need to have a separate require-step, in order to avoid circular require warnings.
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 74 def require_compile_base # ======================================================================= # # === @array_help_options # ======================================================================= # @array_help_options = RBT::ARRAY_HELP_OPTIONS end
Also aliased as: prepare
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/chain_compile.rb, line 59 def reset super() infer_the_namespace # ======================================================================= # # === @array_help_options # ======================================================================= # @array_help_options = [] end
run()
click to toggle source
sanitize_compile_these_programs(i = input?)
click to toggle source
#¶ ↑
sanitize_compile_these_programs
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 181 def sanitize_compile_these_programs(i = input?) i.flatten! # Just in case. i.map! {|entry| entry = entry.dup if entry.frozen? entry.strip! # Don't want whitespace there. RBT.try_to_find_shortcut_for_a_chain_compiled_program(entry) } # ======================================================================= # # Next, perform a separate conversion. # ======================================================================= # i.map! {|entry| _ = RBT.return_chained_programs # Get a handler here. entry = _[entry] if _.has_key? entry if entry.include?(',') and entry.is_a?(String) entry = entry.split(',') end if entry.is_a? Array entry.map!(&:strip) entry.reject!(&:empty?) end entry } i.flatten! if i.is_a? Array end
Also aliased as: sanitize_input
set_compile_these_programs( i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS )
click to toggle source
#¶ ↑
set_compile_these_programs
¶ ↑
Use this method to assign to @compile_these_programs. After that, we will sanitize the input.
If you pass in ?, then we will return the available chained programs.
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 119 def set_compile_these_programs( i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS ) i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS if i.nil? i = ARRAY_DEFAULT_COMPILE_THESE_PROGRAMS if i.empty? if i.is_a? String i = i.split(',') if i.include? ',' end i = [i] unless i.is_a? Array @compile_these_programs = i sanitize_compile_these_programs end
start_batch_compilation()
click to toggle source
#¶ ↑
start_batch_compilation
(batch tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/chain_compile.rb, line 160 def start_batch_compilation notify_the_user_which_programs_we_will_compile # ======================================================================= # # The input has to be sanitized past this point here. # ======================================================================= # input?.each {|this_program| opne "#{rev}Now compiling `#{simp(this_program)}#{rev}`." do_compile_this_program(this_program) } end