Class: CloudConfig::ProviderOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud-config/provider_options.rb

Overview

A helper class for storing provider options.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ProviderOptions

Create a new instance of CloudConfig::ProviderOptions.

Parameters:

  • param (Hash)

    a customizable set of options



12
13
14
15
# File 'lib/cloud-config/provider_options.rb', line 12

def initialize(params = {})
  @preload = params[:preload]
  @klass = params[:class]
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



6
7
8
# File 'lib/cloud-config/provider_options.rb', line 6

def klass
  @klass
end

#preloadObject (readonly)

Returns the value of attribute preload.



6
7
8
# File 'lib/cloud-config/provider_options.rb', line 6

def preload
  @preload
end

Instance Method Details

#async_preload?Boolean

Returns whether asynchronous preloading is enabled for the provider.

Returns:

  • (Boolean)

    Whether asynchronous preloading is enabled



20
21
22
23
24
# File 'lib/cloud-config/provider_options.rb', line 20

def async_preload?
  return false unless preload.is_a?(Hash)

  preload[:async]
end

#to_hHash<Symbol,Object>

Returns the class in the form of a hash

Returns:

  • (Hash<Symbol,Object>)

    Class parameters



29
30
31
# File 'lib/cloud-config/provider_options.rb', line 29

def to_h
  { preload:, class: klass }
end