class SysLibDetector::Displayer
Class responsible for displaying the results of the command line interface class
Public Class Methods
diplay_list_sys_libs(response, gems)
click to toggle source
Displaying the system libraries retrieved @param response [Json] The json response of web-service
in format { gem_1: [a,b,c], gem_2: [x,y,z] }
@param gems [Array] The current project's gems' names
# File lib/sys_lib_detector/displayer.rb, line 9 def self.diplay_list_sys_libs(response, gems) display_header(response, gems) response.each do |gemm, libraries| puts "#{gemm}:" libraries.each do |library| puts " #{library}" end end display_footer if response.count > 0 end
display_header(response, gems)
click to toggle source
Displaying the header message after recieving the web-service response @param response [Json] The json response of web-service
in format { gem_1: [a,b,c], gem_2: [x,y,z] }
@param gems [Array] The current project's gems' names
# File lib/sys_lib_detector/displayer.rb, line 26 def self.display_header(response, gems) gems_found_count = gems_with_libraries_count(response) all_found = gems_found_count == gems.count if(gems_found_count == 0) puts "No system libraries found for your gems, you can contribute by adding libraries!" puts "For more details check https://github.com/HusseinReda/SysLibDetectorGem#contributing" return end if(all_found) puts "Required system libraries found for all your gems!" else puts "Required system libraries found for gems: #{response.keys.join(", ")}" end end
Private Class Methods
gems_with_libraries_count(response)
click to toggle source
# File lib/sys_lib_detector/displayer.rb, line 49 def self.gems_with_libraries_count(response) return response.keys.count end