summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/diff_refs.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-06-20 18:51:48 +0200
committerDouwe Maan <douwe@selenight.nl>2016-07-06 18:50:58 -0400
commita9fa45f09e6b6188691f37d75883b22edce7bba1 (patch)
tree93072651554f59e90c0c2a72761c2bb7f7edc719 /lib/gitlab/diff/diff_refs.rb
parent6ce25e7b4caa9e94de74378729178c7060d640b2 (diff)
downloadgitlab-ce-a9fa45f09e6b6188691f37d75883b22edce7bba1.tar.gz
Represent DiffRefs as proper class instead of tuple array
Diffstat (limited to 'lib/gitlab/diff/diff_refs.rb')
-rw-r--r--lib/gitlab/diff/diff_refs.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb
new file mode 100644
index 00000000000..43489ae876b
--- /dev/null
+++ b/lib/gitlab/diff/diff_refs.rb
@@ -0,0 +1,26 @@
+module Gitlab
+ module Diff
+ class DiffRefs
+ attr_reader :base_sha
+ attr_reader :start_sha
+ attr_reader :head_sha
+
+ def initialize(base_sha:, start_sha: base_sha, head_sha:)
+ @base_sha = base_sha
+ @start_sha = start_sha
+ @head_sha = head_sha
+ end
+
+ def ==(other)
+ other.is_a?(self.class) &&
+ base_sha == other.base_sha &&
+ start_sha == other.start_sha &&
+ head_sha == other.head_sha
+ end
+
+ def complete?
+ start_sha && head_sha
+ end
+ end
+ end
+end