Class: Releases::Source

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/releases/source.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#formatObject

Returns the value of attribute format.



7
8
9
# File 'app/models/releases/source.rb', line 7

def format
  @format
end

#projectObject

Returns the value of attribute project.



7
8
9
# File 'app/models/releases/source.rb', line 7

def project
  @project
end

#tag_nameObject

Returns the value of attribute tag_name.



7
8
9
# File 'app/models/releases/source.rb', line 7

def tag_name
  @tag_name
end

Class Method Details

.all(project, tag_name) ⇒ Object



10
11
12
13
14
# File 'app/models/releases/source.rb', line 10

def all(project, tag_name)
  Gitlab::Workhorse::ARCHIVE_FORMATS.map do |format|
    Releases::Source.new(project: project, tag_name: tag_name, format: format)
  end
end

Instance Method Details

#hook_attrsObject



23
24
25
26
27
28
# File 'app/models/releases/source.rb', line 23

def hook_attrs
  {
    format: format,
    url: url
  }
end

#urlObject



17
18
19
20
21
# File 'app/models/releases/source.rb', line 17

def url
  Gitlab::Routing
    .url_helpers
    .project_archive_url(project, id: File.join(tag_name, archive_prefix), format: format)
end