class RBT::Cookbooks::MultiUrlDisplayer
Public Class Methods
new( optional_arguments = ARGV, run_already = true )
click to toggle source
Public Instance Methods
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/cookbooks/multi_url_displayer/multi_url_displayer.rb, line 42 def reset super() infer_the_namespace # ======================================================================= # # === @show_only_the_URLs # ======================================================================= # @show_only_the_URLs = false end
run()
click to toggle source
#¶ ↑
run¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/multi_url_displayer/multi_url_displayer.rb, line 133 def run menu _ = RBT.file_cookbook_chained_programs if File.exist? _ work_on_these_programs = commandline_arguments? opne "#{rev}Loading the dataset from the file #{sfile(_)} #{rev}next." @dataset = YAML.load_file(_) if work_on_these_programs.empty? opne 'Please supply the names of programs to this class.' else work_on_these_programs.each {|this_component| this_component = sanitize_this_component(this_component) try_to_report_the_URLs_of_this_component(this_component) } end else no_file_exists_at(_) end end
sanitize_this_component(i)
click to toggle source
#¶ ↑
sanitize_this_component
¶ ↑
This can modify some abbreviations, on an ad-hoc basis. May have to be moved to another file one day - let’s see (written this in May 2020).
#¶ ↑
# File lib/rbt/cookbooks/multi_url_displayer/multi_url_displayer.rb, line 98 def sanitize_this_component(i) case i.to_s # ======================================================================= # # === plasma5 # ======================================================================= # when /^plasma5$/ i = 'kde5_plasma' end return i # Don't forget to return our finding here. end
try_to_report_the_URLs_of_this_component(this_component)
click to toggle source
#¶ ↑
try_to_report_the_URLs_of_this_component
¶ ↑
This is the main method that will report the actual URL of a particular component.
#¶ ↑
# File lib/rbt/cookbooks/multi_url_displayer/multi_url_displayer.rb, line 57 def try_to_report_the_URLs_of_this_component(this_component) this_component = this_component.to_s if @dataset.has_key? this_component array = @dataset[this_component] # ===================================================================== # # First notify the user as to how many entries were found. # ===================================================================== # e opne "#{tomato(array.size)} entries were found." e array.each {|this_entry| remote_URL = RBT.remote_url_for?(this_entry.to_sym) if remote_URL.is_a? Array remote_URL = remote_URL.first end if @show_only_the_URLs left_part = '' else # this here is the default entry point. left_part = ( steelblue(" #{this_entry}")+ lightgreen(': ') ).ljust(82) end e left_part+ royalblue(remote_URL) } e else unless this_component.start_with? '--' # Exclude commandline argument flags here. opne 'No key called '+steelblue(this_component)+' was found.' end end end