class Cookbooks::AllUrls
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
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/cookbooks/utility_scripts/all_urls.rb, line 107 def check_for_commandline_arguments case commandline?.to_s # case tag when 'no_opn','disable_opn' no_opn when 'HELP','--help','help' show_help # when 'MISSING','--missing','missing' # @show_only_missing_programs = true end end
commandline?()
click to toggle source
data?()
click to toggle source
Also aliased as: result?
display_start_message_to_the_user()
click to toggle source
no_opn()
click to toggle source
opnn()
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/cookbooks/utility_scripts/all_urls.rb, line 139 def report_result(i = data?) index_counter = 0 buffer_string = ''.dup # This will become the Xorg buffer-string. # ======================================================================= # # Next we iterate over our result. # ======================================================================= # i.each {|name_of_the_program, remote_url| string_to_display = ''.dup name_of_the_program = name_of_the_program.strip increase_index_counter = true remote_url = remote_url.to_s.strip index_counter += 1 if increase_index_counter colourized_counter = index_counter.to_s.rjust(7) if Object.const_defined? :Konsole # Use prettier colours in this case. colourized_counter = Konsole.slateblue(index_counter) else colourized_counter = sfancy(index_counter) end # ===================================================================== # # Build the return String next. # ===================================================================== # if Object.const_defined? :Colours remote_url = Colours::Konsole.palevioletred(remote_url) end string_to_display = '' # string_to_display = ' ' if i.size > 9 # ===================================================================== # # Format the index counter a little # Hmm does not work very well. # ===================================================================== # # string_to_display << (' ' * index_counter.size).rjust(5) string_to_display << ('('+colourized_counter+') ').rjust(15)+ name_of_the_program.ljust(30)+' -> ' string_to_display << remote_url.strip.ljust(40)+N buffer_string << string_to_display # opnn; e 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
Cookbooks::Base#reset
# File lib/cookbooks/utility_scripts/all_urls.rb, line 58 def reset super() @xorg_buffer = nil @array = [] @use_opn = true # Whether to call opnn() or whether we don't. set_commandline_arguments(nil) # Initialize @commandline_arguments here. end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/all_urls.rb, line 212 def run check_for_commandline_arguments display_start_message_to_the_user all_programs = Cookbooks.available_programs? all_programs.each {|program| url = Cookbooks.find_url_for(program) # bl $COOKBOOKS/module_methods/module_methods.rb @array << [program, url.strip] } report_result save_result end
save_result()
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/cookbooks/utility_scripts/all_urls.rb, line 186 def set_the_xorg_buffer_next(i = '') if i.empty? opnn; e 'We can not set the xorg buffer as the input is empty.' else e; opnn; e '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