Class: Github::Nippou::Format
- Inherits:
-
Object
- Object
- Github::Nippou::Format
- Defined in:
- lib/github/nippou/format.rb
Instance Method Summary collapse
- #all(lines) ⇒ Object
-
#initialize(settings, debug) ⇒ Format
constructor
A new instance of Format.
- #line(user_event, i) ⇒ Object
Constructor Details
#initialize(settings, debug) ⇒ Format
Returns a new instance of Format.
9 10 11 12 |
# File 'lib/github/nippou/format.rb', line 9 def initialize(settings, debug) @settings = settings @debug = debug end |
Instance Method Details
#all(lines) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/github/nippou/format.rb', line 35 def all(lines) result = "" prev_repo_name = nil current_repo_name = nil sort(lines).each do |line| current_repo_name = line[:repo_name] unless current_repo_name == prev_repo_name prev_repo_name = current_repo_name result << "\n#{format_subject(current_repo_name)}\n\n" end result << "#{format_line(line)}\n" end result end |
#line(user_event, i) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/github/nippou/format.rb', line 14 def line(user_event, i) STDERR.puts "#{i % settings.thread_num} : #{user_event.html_url}\n" if @debug issue = issue(user_event) line = { title: issue.title, repo_name: user_event.repo.name, url: user_event.html_url, user: issue.user.login, } line[:status] = if issue.merged :merged elsif issue.state == 'closed' :closed end line end |