Class: Hubba::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/hubba/reposet.rb

Overview

todo/check: use a different name e.g (Data)Base, Census, Catalog, Collection, Index, Register or such???

Defined Under Namespace

Classes: Repo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Summary

Returns a new instance of Summary.



61
62
63
64
65
66
67
# File 'lib/hubba/reposet.rb', line 61

def initialize( hash )
  @orgs     = []    # orgs and users -todo/check: use better name - logins or owners? why? why not?

  @repos    = []
  add( hash )

  puts "#{@repos.size} repos @ #{@orgs.size} orgs"
end

Instance Attribute Details

#orgsObject (readonly)

Returns the value of attribute orgs.



59
60
61
# File 'lib/hubba/reposet.rb', line 59

def orgs
  @orgs
end

#reposObject (readonly)

Returns the value of attribute repos.



59
60
61
# File 'lib/hubba/reposet.rb', line 59

def repos
  @repos
end

Instance Method Details

#add(hash) ⇒ Object

private helpes



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/hubba/reposet.rb', line 71

def add( hash )   ## add repos.yml set

  hash.each do |org_with_counter, names|
    ## remove optional number from key e.g.

    ##   mrhydescripts (3)    =>  mrhydescripts

    ##   footballjs (4)       =>  footballjs

    ##   etc.

    org = org_with_counter.sub( /\([0-9]+\)/, '' ).strip
    repos = []
    names.each do |name|
      repo = Repo.new( org, name )
      repos << repo
    end
    @orgs << [org, repos]
    @repos += repos
  end
end