Method: AzureResourceTypeCounts#initialize

Defined in:
lib/resources/azure/azure_backend.rb

#initialize(counts) ⇒ Object

Constructor to setup a new class for a specific Azure Resource type. It should be passed a hashtable with information such as:

{
  "Compute/virtualMachines" => 2,
  "Network/networkInterfaces" => 3
}

This will result in two methods being created on the class:

- Compute/virtualNetworks
- Network/networkInterfaces

Each of which will return the corresponding count value

Parameters:

  • Hash

    counts Hash table of types and the count of each one

Since:

  • 0.2.0



303
304
305
306
307
308
309
# File 'lib/resources/azure/azure_backend.rb', line 303

def initialize(counts)
  counts.each do |type, count|
    define_singleton_method type do
      count
    end
  end
end