Class: CodeInventory::Inventory
- Inherits:
-
Object
- Object
- CodeInventory::Inventory
- Defined in:
- lib/codeinventory/inventory.rb
Instance Attribute Summary collapse
-
#sources ⇒ Object
Returns the value of attribute sources.
Instance Method Summary collapse
- #generate(agency, version) ⇒ Object
-
#initialize(*sources) ⇒ Inventory
constructor
A new instance of Inventory.
- #projects ⇒ Object
Constructor Details
#initialize(*sources) ⇒ Inventory
Returns a new instance of Inventory.
5 6 7 |
# File 'lib/codeinventory/inventory.rb', line 5 def initialize(*sources) @sources = [sources].flatten end |
Instance Attribute Details
#sources ⇒ Object
Returns the value of attribute sources.
3 4 5 |
# File 'lib/codeinventory/inventory.rb', line 3 def sources @sources end |
Instance Method Details
#generate(agency, version) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/codeinventory/inventory.rb', line 18 def generate(agency, version) { "agency": agency, "version": version, "measurementType" => { "method" => "modules" }, "releases": projects } end |
#projects ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/codeinventory/inventory.rb', line 9 def projects @sources.collect { |src| src.projects do |project| yield project, src if block_given? project end }.flatten end |