Class: Veye::Github::SearchCSV

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

Instance Method Summary collapse

Methods inherited from BaseCSV

#after, #before

Constructor Details

#initializeSearchCSV

Returns a new instance of SearchCSV.



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

def initialize
  columns = %w[nr,name,language,owner_name,owner_type,private,fork,watchers,forks,git_url]
  super(columns)
end

Instance Method Details

#format(results) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/veye/views/github/search_csv.rb', line 11

def format(results)
  return if results.nil?

  results['results'].each_with_index do |result, index|
    print_row(result, index)
  end
end


19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/veye/views/github/search_csv.rb', line 19

def print_row(result, index)
  printf("%d,%s,%s,%s,%s,%s,%s,%s,%s,%s\n",
          index + 1,
          result['name'],
          result['language'],
          result['owner_name'],
          result['owner_type'],
          result['private'],
          result['fork'],
          result['watchers'],
          result['forks'],
          result['git_url']
        )
end