Class: DockerDistribution::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_distribution/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain = nil, path = nil) ⇒ Repository

Returns a new instance of Repository.



7
8
9
10
# File 'lib/docker_distribution/repository.rb', line 7

def initialize(domain = nil, path = nil)
  @domain = domain
  @path = path
end

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



5
6
7
# File 'lib/docker_distribution/repository.rb', line 5

def domain
  @domain
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/docker_distribution/repository.rb', line 5

def path
  @path
end

Instance Method Details

#familiarObject



30
31
32
# File 'lib/docker_distribution/repository.rb', line 30

def familiar
  Normalize.familiarize_name(self)
end

#nameObject



12
13
14
15
16
# File 'lib/docker_distribution/repository.rb', line 12

def name
  return path if Helpers.empty?(domain)

  [domain, path].join("/")
end

#to_hObject



22
23
24
25
26
27
28
# File 'lib/docker_distribution/repository.rb', line 22

def to_h
  {
    repository: name,
    domain: domain,
    path: path
  }
end

#to_sObject



18
19
20
# File 'lib/docker_distribution/repository.rb', line 18

def to_s
  name
end