Class: Veye::Github::InfoCSV

Inherits:
BaseCSV
  • Object
show all
Defined in:
lib/veye/views/github/info_csv.rb

Instance Method Summary collapse

Methods inherited from BaseCSV

#after, #before

Constructor Details

#initializeInfoCSV

Returns a new instance of InfoCSV.



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

def initialize
  headers = "name,language,owner_login,owner_type,private,fork,branches,imported_projects,description"
  super(headers)
end

Instance Method Details

#format(results) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/veye/views/github/info_csv.rb', line 10

def format(results)
  return nil if results.nil?
  repo = results['repo']
  imported_projects = results['imported_projects']
  imported_project_names = imported_projects.map {|p| p['id']}
  printf(
    "%s,%s,%s,%s,%s,%s,%s,%s,%s\n",
    repo['fullname'],
    repo['language'],
    repo['owner_login'],
    repo['owner_type'],
    repo['private'],
    repo['fork'],
    repo['branches'].to_a.join('|'),
    imported_project_names.to_a.join('|'),
    repo['description']
  )
end