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 ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Class Method Summary collapse

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

#serializable_hash

Class Method Details

.full_path_from(package_username:) ⇒ Object



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

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

.package_username_from(full_path:) ⇒ Object



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

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

.validate_username_and_channel(username, channel) {|none_field| ... } ⇒ Object

Yields:

  • (none_field)


34
35
36
37
38
39
40
41
# File 'app/models/packages/conan/metadatum.rb', line 34

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

  none_field = username == NONE_VALUE ? :username : :channel

  yield(none_field)
end

Instance Method Details

#recipeObject



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

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

#recipe_pathObject



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

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