class Rudisco::CLI::Presentation::Show

Attributes

record[R]

@return [Rudisco::Gem]

Public Class Methods

new(**params) click to toggle source
# File lib/rudisco/cli/presentation/show.rb, line 6
def initialize(**params) # no-doc
  @record = params[:record]
end

Public Instance Methods

show() click to toggle source
# File lib/rudisco/cli/presentation/show.rb, line 10
def show # no-doc
  report message: '', complete: '' do
    if record
      show_detailed_gem_description
    else
      gem_not_found
    end
  end # report message
end

Private Instance Methods

gem_not_found() click to toggle source
# File lib/rudisco/cli/presentation/show.rb, line 22
def gem_not_found # no-doc
  aligned ""
  aligned "Gem not found. Sorry.", bold: true, width: 80,
                                               align: 'center'
  aligned ""
end
show_detailed_gem_description() click to toggle source
# File lib/rudisco/cli/presentation/show.rb, line 29
def show_detailed_gem_description # no-doc
  table(border: true,  width: 80) do
    row { column 'Description', width: 80, align: 'center' }
    row { column record.description }
  end

  aligned ""

  table(border: false,  width: 80) do
    row do
      column 'Total downloads',   width: 18, align: 'center'
      column 'Version downloads', width: 18, align: 'center'
      column 'Version',           width: 18, align: 'center'
      column 'License',           width: 17, align: 'center'
    end
    row do
      column record.total_downloads
      column record.version_downloads
      column record.version
      column record.license
    end
  end # table

  aligned ""

  table(border: false,  width: 80) do
    row do
      column 'wiki_url',          width: 18, align: 'center'
      column 'documentation_url', width: 18, align: 'center'
      column 'mailing_list_url',  width: 18, align: 'center'
      column 'bug_tracker_url',   width: 17, align: 'center'
    end
    row do
      column url_helper(record.wiki_url)
      column url_helper(record.documentation_url)
      column url_helper(record.mailing_list_url)
      column url_helper(record.bug_tracker_url)
    end
  end # table

  aligned ""

  table(border: false,  width: 80) do
    row do
      column 'Authors', width: 20, align: 'center', padding: 2
      column 'Sha',     width: 57, align: 'center', padding: 10
    end
    row do
      column record.authors
      column record.sha
    end
  end # table
end
url_helper(url) click to toggle source
# File lib/rudisco/cli/presentation/show.rb, line 83
def url_helper(url) # no-doc
  if url.nil? || url.empty?
    return "no"
  else
    return "yes"
  end
end