Class: Zypper::Onlinesearch::View::Page::Common

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

Overview

Common view elements for page operation.

Direct Known Subclasses

Links::Common, Report, Table

Class Method Summary collapse

Class Method Details

.general(args) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/zypper/onlinesearch/view.rb', line 124

def self.general(args)
  engine = args[:engine].bold.red
  distro = args[:distro].bold.blue
  arch = PageData::ARCHS[args[:architecture]].bold
  cache = if args[:refresh]
            "Off".bold
          elsif args[:cache_time]
            "#{"On".bold.yellow} (#{args[:cache_time].strftime("%Y-%m-%d %H:%M")})"
          else
            "#{"On".bold.yellow} (Now)"
          end

  puts ""
  puts "=" * SEPARATOR_LENGTH
  puts "#{"Parameters: ".bold} Engine: #{engine} | OS: #{distro} | Arch.: #{arch} | Cache: #{cache}"
  puts "=" * SEPARATOR_LENGTH
  puts "#{"Name:        ".bold}#{args[:name]}"
  puts "#{"Summary:     ".bold}#{args[:short_description]}" if args[:short_description]
  puts "#{"Description: ".bold}#{args[:description].chomp}" if args[:description]
end

.no_item(num) ⇒ Object



151
152
153
154
# File 'lib/zypper/onlinesearch/view.rb', line 151

def self.no_item(num)
  separator
  puts "#{" " * 3} - | Invalid item number #{num}"
end

.no_packages(compatible) ⇒ Object



145
146
147
148
149
# File 'lib/zypper/onlinesearch/view.rb', line 145

def self.no_packages(compatible)
  separator
  puts "#{" " * 3} - | No #{compatible ? "compatible" : ""} packages found!"
  separator
end

.separatorObject



120
121
122
# File 'lib/zypper/onlinesearch/view.rb', line 120

def self.separator
  puts "-" * SEPARATOR_LENGTH
end