Class: AsciiBinderGabrielRH::SiteInfo
- Inherits:
-
Object
- Object
- AsciiBinderGabrielRH::SiteInfo
- Defined in:
- lib/ascii_binder_gabriel_rh/site_info.rb
Instance Attribute Summary collapse
-
#branches ⇒ Object
readonly
Returns the value of attribute branches.
-
#distros ⇒ Object
readonly
Returns the value of attribute distros.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #add_distro(distro) ⇒ Object
-
#initialize(distro) ⇒ SiteInfo
constructor
A new instance of SiteInfo.
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
#branches ⇒ Object (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 |
#distros ⇒ Object (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 |
#id ⇒ Object (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 |
#name ⇒ Object (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 |
#url ⇒ Object (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 |