gitlab-org--gitlab-foss/lib/gitlab/badge/template.rb
gfyoung e166e5747c Enable some frozen string in lib/gitlab
Enable frozen string for the following files:

* lib/gitlab/auth/**/*.rb
* lib/gitlab/badge/**/*.rb
* lib/gitlab/bare_repository_import/**/*.rb
* lib/gitlab/bitbucket_import/**/*.rb
* lib/gitlab/bitbucket_server_import/**/*.rb
* lib/gitlab/cache/**/*.rb
* lib/gitlab/checks/**/*.rb

Partially addresses #47424.
2018-10-13 02:31:31 -07:00

51 lines
821 B
Ruby

# frozen_string_literal: true
module Gitlab
module Badge
##
# Abstract template class for badges
#
class Template
def initialize(badge)
@entity = badge.entity
@status = badge.status
end
def key_text
raise NotImplementedError
end
def value_text
raise NotImplementedError
end
def key_width
raise NotImplementedError
end
def value_width
raise NotImplementedError
end
def value_color
raise NotImplementedError
end
def key_color
'#555'
end
def key_text_anchor
key_width / 2
end
def value_text_anchor
key_width + (value_width / 2)
end
def width
key_width + value_width
end
end
end
end