summaryrefslogtreecommitdiff
path: root/app/models/commit_range.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit_range.rb')
-rw-r--r--app/models/commit_range.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/models/commit_range.rb b/app/models/commit_range.rb
index 094747ee48d..1489a330be3 100644
--- a/app/models/commit_range.rb
+++ b/app/models/commit_range.rb
@@ -36,7 +36,7 @@ class CommitRange
STRICT_PATTERN = /\h{7,40}\.{2,3}\h{7,40}/
def self.reference_prefix
- '@'
+ "@"
end
# Pattern used to extract commit range references from text
@@ -64,7 +64,7 @@ class CommitRange
range_string = range_string.strip
- unless range_string =~ /\A#{PATTERN}\z/
+ unless /\A#{PATTERN}\z/.match?(range_string)
raise ArgumentError, "invalid CommitRange string format: #{range_string}"
end
@@ -89,15 +89,15 @@ class CommitRange
sha_from + notation + sha_to
end
- alias_method :id, :to_s
+ alias id to_s
def to_reference(from = nil, full: false)
project_reference = project.to_reference(from, full: full)
if project_reference.present?
- project_reference + self.class.reference_prefix + self.id
+ project_reference + self.class.reference_prefix + id
else
- self.id
+ id
end
end
@@ -116,11 +116,11 @@ class CommitRange
#
# See `namespace_project_compare_url`
def to_param
- { from: sha_start, to: sha_to }
+ {from: sha_start, to: sha_to}
end
def exclude_start?
- @notation == '..'
+ @notation == ".."
end
# Check if both the starting and ending commit IDs exist in a project's
@@ -148,7 +148,7 @@ class CommitRange
def sha_start
return nil unless sha_from
- exclude_start? ? sha_from + '^' : sha_from
+ exclude_start? ? sha_from + "^" : sha_from
end
def commit_start
@@ -161,6 +161,6 @@ class CommitRange
end
end
- alias_method :sha_end, :sha_to
- alias_method :commit_end, :commit_to
+ alias sha_end sha_to
+ alias commit_end commit_to
end