Class: Badge
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Badge
- Includes:
- FromUnion
- Defined in:
- app/models/badge.rb
Direct Known Subclasses
Constant Summary collapse
- PLACEHOLDERS =
This structure sets the placeholders that the urls can have. This hash also sets which action to ask when the placeholder is found.
{ 'project_path' => :full_path, 'project_title' => :title, 'project_name' => :path, 'project_id' => :id, 'default_branch' => :default_branch, 'commit_sha' => ->(project) { project.commit&.sha } }.freeze
- PLACEHOLDERS_REGEX =
This regex is built dynamically using the keys from the PLACEHOLDER struct. So, we can easily add new placeholder just by modifying the PLACEHOLDER hash. This regex will build the new PLACEHOLDER_REGEX with the new information
/(#{PLACEHOLDERS.keys.join('|')})/
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Instance Method Summary collapse
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Instance Method Details
#rendered_image_url(project = nil) ⇒ Object
36 37 38 39 40 |
# File 'app/models/badge.rb', line 36 def rendered_image_url(project = nil) Gitlab::AssetProxy.proxy_url( build_rendered_url(image_url, project) ) end |
#rendered_link_url(project = nil) ⇒ Object
32 33 34 |
# File 'app/models/badge.rb', line 32 def rendered_link_url(project = nil) build_rendered_url(link_url, project) end |