Class: PullRequestSummarizer::Report::PeopleAdditionalNames
- Inherits:
-
PeopleNames
- Object
- Base
- PeopleNames
- PullRequestSummarizer::Report::PeopleAdditionalNames
- Defined in:
- lib/pull_request_summarizer/report/people_addtional_names.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from PeopleNames
Methods inherited from Base
Constructor Details
This class inherits a constructor from PullRequestSummarizer::Report::Base
Instance Method Details
#changed ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pull_request_summarizer/report/people_addtional_names.rb', line 6 def changed all_names = lambda do |p| other_names = p.other_names.map { |n| n[:name] } rescue [] (other_names | [p.name]).to_set end names_all_pre = Hash[before.persons.map { |p| [p.id, all_names.call(p)] }] names_all_post = Hash[after.persons.map { |p| [p.id, all_names.call(p)] }] in_both = names_all_pre.keys & names_all_post.keys in_both.select { |id| names_all_pre[id] != names_all_post[id] }.map do |id| { id: id, name: before_names[id], removed: (names_all_pre[id] - names_all_post[id]).to_a, added: (names_all_post[id] - names_all_pre[id]).to_a, } end end |