Class: SysLibDetector::Displayer
- Inherits:
-
Object
- Object
- SysLibDetector::Displayer
- Defined in:
- lib/sys_lib_detector/displayer.rb
Overview
Class responsible for displaying the results of the command line interface class
Class Method Summary collapse
-
.diplay_list_sys_libs(response, gems) ⇒ Object
Displaying the system libraries retrieved in format { gem_1: [a,b,c], gem_2: [x,y,z] }.
-
.display_header(response, gems) ⇒ Object
Displaying the header message after recieving the web-service response in format { gem_1: [a,b,c], gem_2: [x,y,z] }.
- .gems_with_libraries_count(response) ⇒ Object
Class Method Details
.diplay_list_sys_libs(response, gems) ⇒ Object
Displaying the system libraries retrieved in format { gem_1: [a,b,c], gem_2: [x,y,z] }
9 10 11 12 13 14 15 16 17 18 19 20 |
# 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) ⇒ Object
Displaying the header message after recieving the web-service response in format { gem_1: [a,b,c], gem_2: [x,y,z] }
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sys_lib_detector/displayer.rb', line 32 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 |
.gems_with_libraries_count(response) ⇒ Object
24 25 26 |
# File 'lib/sys_lib_detector/displayer.rb', line 24 def self.gems_with_libraries_count(response) return response.keys.count end |