Class: Vagrant::Plugin::V2::Components

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/plugin/v2/components.rb

Overview

This is the container class for the components of a single plugin. This allows us to separate the plugin class which defines the components, and the actual container of those components. This removes a bit of state overhead from the plugin class itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeComponents

Returns a new instance of Components.



19
20
21
22
23
24
25
# File 'lib/vagrant/plugin/v2/components.rb', line 19

def initialize
  # The action hooks hash defaults to []
  @action_hooks = Hash.new { |h, k| h[k] = [] }

  # Create the configs hash which defaults to a registry
  @configs = Hash.new { |h, k| h[k] = Registry.new }
end

Instance Attribute Details

#action_hooksHash<Symbol, Array> (readonly)

This contains all the action hooks.

Returns:

  • (Hash<Symbol, Array>)


12
13
14
# File 'lib/vagrant/plugin/v2/components.rb', line 12

def action_hooks
  @action_hooks
end

#configsHash<Symbol, Registry> (readonly)

This contains all the configuration plugins by scope.

Returns:



17
18
19
# File 'lib/vagrant/plugin/v2/components.rb', line 17

def configs
  @configs
end