class RBT::Cookbooks::FeedbackLicenses
Constants
- DEFAULT_FILTER_TO_USE
#¶ ↑
DEFAULT_FILTER_TO_USE
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
- PADDING_LEFT
#¶ ↑
PADDING_LEFT
¶ ↑#¶ ↑
- PADDING_TO_USE
#¶ ↑
PADDING_TO_USE
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
new( filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
Usage example:
FeedbackLicenses.new(filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true)
If the filter is * then we will filter for ALL licenses.
#¶ ↑
Calls superclass method
RBT::Base::new
# File lib/rbt/utility_scripts/feedback_licenses.rb, line 49 def initialize( filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true ) super() reset set_filter_for_licenses(filter_for_licenses) run if run_already end
Public Instance Methods
feedback_licenses()
click to toggle source
#¶ ↑
feedback_licenses
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/feedback_licenses.rb, line 109 def feedback_licenses cliner { _ = 'known licenses' # Placeholder for now. _ = filter? unless filter? == DEFAULT_FILTER_TO_USE opnn; e 'Feedback licenses matching search-criteria for' opnn; e '`'+sfancy(_.to_s)+'` in alphabetical order next:' } output_header cliner { programs = available_programs? programs.each { |program| @cookbook = RBT::Cookbooks::Cookbook.new(program) { :bypass_menu } license = return_license if license.is_a? Array license = license.join(', ') end next if license == 'unknown' full_license_text = PADDING_LEFT+'%-25s' % program+' | '+'%-10s' % license if @filter == DEFAULT_FILTER_TO_USE e full_license_text else # else we assume user wants filtering done unless license.to_s.downcase.scan(/#{filter?}/).empty? e full_license_text end end } } end
filter?()
click to toggle source
output_header()
click to toggle source
#¶ ↑
output_header
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/feedback_licenses.rb, line 91 def output_header # ===================================================================== # # This is the header content. # ===================================================================== # e PADDING_LEFT+('%-25s' % 'Name ')+ ' | License |' end
reset()
click to toggle source
return_license()
click to toggle source
run()
click to toggle source
set_filter_for_licenses(i = DEFAULT_FILTER_TO_USE)
click to toggle source
#¶ ↑
set_filter_for_licenses
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/feedback_licenses.rb, line 72 def set_filter_for_licenses(i = DEFAULT_FILTER_TO_USE) i = i.first if i.is_a? Array i = DEFAULT_FILTER_TO_USE if i.nil? i = DEFAULT_FILTER_TO_USE if i.empty? i = i.to_s.dup i = i.downcase @filter = i end
Also aliased as: filter_for