Class: Hubba::Summary
- Inherits:
-
Object
- Object
- Hubba::Summary
- 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
-
#orgs ⇒ Object
readonly
Returns the value of attribute orgs.
-
#repos ⇒ Object
readonly
Returns the value of attribute repos.
Instance Method Summary collapse
-
#add(hash) ⇒ Object
private helpes.
-
#initialize(hash) ⇒ Summary
constructor
A new instance of Summary.
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
#orgs ⇒ Object (readonly)
Returns the value of attribute orgs.
59 60 61 |
# File 'lib/hubba/reposet.rb', line 59 def orgs @orgs end |
#repos ⇒ Object (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 |