Permalink
Browse files
simplified #changed_methods, #added_methods, and #removed_methods
- Loading branch information...
Showing
with
14 additions
and
6 deletions.
-
+14
−6
delta.rb
|
@@ -9,18 +9,26 @@ def initialize events, first_commit, second_commit |
|
|
end
|
|
|
|
|
|
def removed_methods
|
|
|
- @repository.methods.select { |m| m.events.count == 1 }
|
|
|
- .select { |m| m.events.first.commit == @first_commit }
|
|
|
+ methods_with_only @first_commit
|
|
|
end
|
|
|
|
|
|
def added_methods
|
|
|
- @repository.methods.select {|m| m.events.count == 1 }
|
|
|
- .select { |m| m.events.first.commit == @second_commit }
|
|
|
+ methods_with_only @second_commit
|
|
|
end
|
|
|
|
|
|
def changed_methods
|
|
|
- @repository.methods.select { |m| m.events.count == 2 }
|
|
|
- .select { |m| m.events[0].complexity != m.events[1].complexity }
|
|
|
+ methods_with_both_commits.select { |m| m.events[0].complexity != m.events[1].complexity }
|
|
|
+ end
|
|
|
+
|
|
|
+ private
|
|
|
+
|
|
|
+ def methods_with_only commit
|
|
|
+ @repository.methods.select { |m| m.events.count == 1 }
|
|
|
+ .select { |m| m.events.first.commit == commit }
|
|
|
+ end
|
|
|
+
|
|
|
+ def methods_with_both_commits
|
|
|
+ @repository.methods.select { |m| m.events.count == 2 }
|
|
|
end
|
|
|
end
|
|
|
|
|
|
0 comments on commit
b3ffa52