Class: Packages::Conan::Metadatum

Inherits:
ApplicationRecord show all
Defined in:
app/models/packages/conan/metadatum.rb

Constant Summary collapse

NONE_VALUE =
'_'

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, 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 Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.full_path_from(package_username:) ⇒ Object



29
30
31
# File 'app/models/packages/conan/metadatum.rb', line 29

def self.full_path_from(package_username:)
  package_username.tr('+', '/')
end

.package_username_from(full_path:) ⇒ Object



25
26
27
# File 'app/models/packages/conan/metadatum.rb', line 25

def self.package_username_from(full_path:)
  full_path.tr('/', '+')
end

.validate_username_and_channel(username, channel) ⇒ Object



33
34
35
36
37
# File 'app/models/packages/conan/metadatum.rb', line 33

def self.validate_username_and_channel(username, channel)
  return if channel == NONE_VALUE || username != NONE_VALUE

  yield if block_given?
end

Instance Method Details

#recipeObject



17
18
19
# File 'app/models/packages/conan/metadatum.rb', line 17

def recipe
  "#{package.name}/#{package.version}@#{package_username}/#{package_channel}"
end

#recipe_pathObject



21
22
23
# File 'app/models/packages/conan/metadatum.rb', line 21

def recipe_path
  recipe.tr('@', '/')
end