Class: Zypper::Onlinesearch::View::Page::Report

Inherits:
Common
  • Object
show all
Defined in:
lib/zypper/onlinesearch/view.rb

Overview

Report view for page operation.

Class Method Summary collapse

Methods inherited from Common

general, no_item, no_packages, separator

Class Method Details

.header(args) ⇒ Object



208
209
210
211
212
213
# File 'lib/zypper/onlinesearch/view.rb', line 208

def self.header(args)
  @@second_col = args[:second_col]
  separator
  puts "#{" " * 3} # | Info"
  separator
end

.package(args) ⇒ Object



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/zypper/onlinesearch/view.rb', line 215

def self.package(args)
  n_length = args[:num].to_s.length
  num = args[:num].to_s.bold.send(TYPE_COLORS[args[:pack][:type]])
  repo = args[:pack][:repo].bold.send(TYPE_COLORS[args[:pack][:type]])
  distro = if args[:args][:distro] == args[:pack][:distro]
             args[:pack][:distro].bold.blue
           else
             args[:pack][:distro]
           end
  version = args[:pack][:version].to_s
  type = args[:pack][:type].to_s.capitalize.bold.send(TYPE_COLORS[args[:pack][:type]])
  prefix = " " * 5

  puts "#{" " * (5 - n_length)}#{num} | Version: #{version}"
  puts "#{prefix} | Repository: #{repo}"
  puts "#{prefix} | Distribution: #{distro}" if @@second_col.positive?
  # puts #{prefix} | Formats: ' + args[:formats].join(', ')
  puts "#{prefix} | Type: #{type}"
  separator
end