Class: Veye::Github::InfoTable

Inherits:
BaseTable show all
Defined in:
lib/veye/views/github/info_table.rb

Instance Method Summary collapse

Methods inherited from BaseTable

#after, #before

Constructor Details

#initializeInfoTable

Returns a new instance of InfoTable.



6
7
8
9
# File 'lib/veye/views/github/info_table.rb', line 6

def initialize
  headings = %w(name language owner_login owner_type private fork branches imported_projects description)
  super("Repository information", headings)
end

Instance Method Details

#format(result) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/veye/views/github/info_table.rb', line 11

def format(result)
  return if result.nil?

  repo = result['repo']
  if repo.nil?
    puts "Error: Cant import."
    return false
  end

  projects = result['imported_projects']
  if projects
    project_names = projects.map {|x| x['id']}
  else
    project_names = []
  end

  row = [repo['fullname']]
  row << repo['language']
  row << repo['owner_login']
  row << repo['owner_type']
  row << repo['private']
  row << repo['fork']
  row << repo['branches'].to_a.join("\n")
  row << project_names.join("\n")
  row << repo['description']

  @table << row
end