class RBT::Cookbooks::AllUrls
Public Class Methods
new( commandline_arguments = nil, run_already = true )
click to toggle source
Public Instance Methods
check_for_commandline_arguments()
click to toggle source
#¶ ↑
check_for_commandline_arguments
¶ ↑
We will work on a String - no need to care for Symbols here.
#¶ ↑
# File lib/rbt/cookbooks/all_urls.rb, line 103 def check_for_commandline_arguments case commandline?.to_s # case tag # ======================================================================= # # === all_urls --no-opn # ======================================================================= # when /-?-?no(_|-)?opn/,'disable_opn' no_opn # ======================================================================= # # === all_urls --help # ======================================================================= # when /^-?-?help/i show_help # when 'MISSING','--missing','missing' # @show_only_missing_programs = true end end
colourize_this_link(i)
click to toggle source
commandline?()
click to toggle source
data?()
click to toggle source
Also aliased as: result?
display_start_message_to_the_user()
click to toggle source
report_result( i = data? )
click to toggle source
#¶ ↑
report_result
¶ ↑
Here we can report the result, which is usually what we stored in our main array called @array.
#¶ ↑
# File lib/rbt/cookbooks/all_urls.rb, line 163 def report_result( i = data? ) index_counter = 0 buffer_string = ''.dup # This will become the Xorg buffer-string. pad_right = ' ' * 33 # ======================================================================= # # Next we iterate over our result. # ======================================================================= # i.each {|name_of_the_program, remote_url1, remote_url2| string_to_display = ''.dup name_of_the_program = name_of_the_program.strip increase_index_counter = true remote_url1 = remote_url1.to_s.strip index_counter += 1 if increase_index_counter colourized_counter = index_counter.to_s.rjust(7) colourized_counter = slateblue(index_counter) string_to_display << ('('+colourized_counter+') ').rjust(15) # ===================================================================== # # Build the return String next. # ===================================================================== # remote_url1 = colourize_this_link(remote_url1) string_to_display = ''.dup string_to_display << name_of_the_program.ljust(30)+ steelblue(' → ') string_to_display << remote_url1.strip.ljust(40)+N buffer_string << string_to_display if show_url2? remote_url2 = pad_right+remote_url2.strip buffer_string << string_to_display string_to_display << colourize_this_link( remote_url2 )+N buffer_string << N end buffer_string << string_to_display e string_to_display } # ======================================================================= # # Also assign this to the xorg buffer. # ======================================================================= # set_the_xorg_buffer_next(buffer_string) end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/cookbooks/all_urls.rb, line 57 def reset super() infer_the_namespace try_to_require_the_xorg_buffer # === @xorg_buffer @xorg_buffer = nil @array = [] @use_opn = true # Whether to call opnn() or whether we don't. @also_show_url2 = true # <- Whether to try to show url2, too. set_commandline_arguments(nil) # Initialize @commandline_arguments here. end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/all_urls.rb, line 224 def run check_for_commandline_arguments display_start_message_to_the_user all_programs = available_programs? all_programs.each {|program| result = RBT.find_url_for(program) # bl $COOKBOOKS/module_methods/module_methods.rb url1 = result.first.to_s.strip url2 = result.last.to_s.strip @array << [program, url1, url2] } report_result save_result end
save_result( into = "
click to toggle source
set_commandline_arguments(i = ARGV)
click to toggle source
set_the_xorg_buffer_next(i = '')
click to toggle source
#¶ ↑
set_the_xorg_buffer_next
¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/all_urls.rb, line 210 def set_the_xorg_buffer_next(i = '') if i.empty? opne 'We can not set the xorg buffer as the input is empty.' else e; opne 'We will set the xorgbuffer next with the above '\ 'programs as our result.' @xorg_buffer = i set_xorg_buffer(@xorg_buffer) end end
show_help()
click to toggle source
show_url2?()
click to toggle source