Class: AsciiBinderGabrielRH::SiteInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii_binder_gabriel_rh/site_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(distro) ⇒ SiteInfo

Returns a new instance of SiteInfo.



5
6
7
8
9
10
11
12
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 5

def initialize(distro)
  @id       = distro.site.id
  @name     = distro.site.name
  @url      = distro.site.url
  @distros  = {}
  @branches = ['main']
  add_distro(distro)
end

Instance Attribute Details

#branchesObject (readonly)

Returns the value of attribute branches.



3
4
5
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 3

def branches
  @branches
end

#distrosObject (readonly)

Returns the value of attribute distros.



3
4
5
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 3

def distros
  @distros
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 3

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 3

def url
  @url
end

Instance Method Details

#add_distro(distro) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ascii_binder_gabriel_rh/site_info.rb', line 14

def add_distro(distro)
  @distros[distro.id] = distro.branches
  distro.branches.each do |branch|
    next if @branches.include?(branch.id)
    @branches << branch.id
  end
end