module SparkleFormation::SparkleAttribute

Provides template helper methods

Provides template helper methods

Provides template helper methods

Provides template helper methods

Provides template helper methods

Provides template helper methods

Constants

OpenStack

Heat specific helper implementations

Public Instance Methods

__attribute_key(key) click to toggle source

Format the provided key. If symbol type is provided formatting is forced. Otherwise the default formatting is applied

@param key [String, Symbol] given key @return [String] formatted key

# File lib/sparkle_formation/sparkle_attribute.rb, line 151
def __attribute_key(key)
  if key.is_a?(::Symbol) || key.is_a?(::String)
    _process_key(key, key.is_a?(::Symbol) ? :force : nil)
  else
    key
  end
end
_dynamic(name, *args, &block) click to toggle source

@overload _dynamic(resource_type, custom_name, options={})

Insert builtin resource
@param resource_type [String, Symbol] provider resource type
@param custom_name [String, Symbol] custom name used for resource name generation
@param options [Hash]
@option options [String, NilClass] :resource_name_suffix custom suffix to use for
  name generation (defaults to resource_type)
@note All other options are set into the new resource's properties

@overload _dynamic(dynamic_name, custom_name, options={})

Call custom dynamic from available sparkle packs
@param dynamic_name [Symbol] name of registered dynamic
@param custom_name [Symbol, String] unique name passed directly to registered dynamic
@param options [Hash]
@option options [String, Symbol] :provider override provider restriction when fetching dynamic
@note All options are passed to dynamic with custom_name

@yield [new_struct] Provides newly inserted structure @yieldparam new_struct [SparkleStruct] newly inserted structure which can be modified @yieldreturn [Object] discarded @return [self]

# File lib/sparkle_formation/sparkle_attribute.rb, line 101
def _dynamic(name, *args, &block)
  SparkleFormation.insert(name, self, *args, &block)
end
Also aliased as: dynamic!
_method(*args) click to toggle source

@overload _method(sym)

Lookup a method definition on self
@param sym [Symbol] name of method

@note usually used as `puts! method!(:foo).source_location` @see Object#method @return [Method]

# File lib/sparkle_formation/sparkle_attribute.rb, line 76
def _method(*args)
  ::Kernel.instance_method(:method).bind(self).call(*args)
end
Also aliased as: method!
_nest(template, *args, &block) click to toggle source

@overload _nest(template, *names, options={})

Nest a stack resource
@param template [String, Symbol] name of desired template
@param names [String, Symbol] list of optional string/symbol values for resource name generation
@param options [Hash]
@option options [String, Symbol] :provider override provider restriction when
  fetching template
@option options [Truthy, Falsey] :overwrite_name when set to true, will not include
  template name in resource name
@option options [Hash] :parameters compile time parameter values to pass to nested template

@yield [new_struct] Provides newly inserted structure @yieldparam new_struct [SparkleStruct] newly inserted structure which can be modified @yieldreturn [Object] discarded @return [self]

# File lib/sparkle_formation/sparkle_attribute.rb, line 139
def _nest(template, *args, &block)
  SparkleFormation.nest(template, self, *args, &block)
end
Also aliased as: nest!
_puts(*args) click to toggle source

@overload _puts(obj, …)

Print to stdout
@param obj [Object] object to print

@see Kernel.puts @return [NilClass]

# File lib/sparkle_formation/sparkle_attribute.rb, line 56
def _puts(*args)
  $stdout.puts(*args)
end
Also aliased as: puts!
_raise(*args) click to toggle source

Raise an exception @see Kernel.raise

# File lib/sparkle_formation/sparkle_attribute.rb, line 64
def _raise(*args)
  ::Kernel.raise(*args)
end
Also aliased as: raise!
_registry(name, *args) click to toggle source

@overload _registry(name)

Return value from registry item with given name
@param name [String, Symbol] registry item name

@overload _registry(name, *args, options={})

Pass given parameters to registry item with given name and
return the value
@param name [String, Symbol] registry item name
@param options [Hash]
@param options [Hash] :provider override provider restriction when fetching registry item
@param args [Object] argument list
@note args and options will be passed directly to registry item when called

@return [Object] return value of registry item

# File lib/sparkle_formation/sparkle_attribute.rb, line 119
def _registry(name, *args)
  SparkleFormation.registry(name, self, *args)
end
Also aliased as: registry!
_resource_name() click to toggle source

Return current resource name

@return [String]

# File lib/sparkle_formation/sparkle_attribute.rb, line 18
def _resource_name
  result = nil
  if _parent
    if _parent._parent == _root
      result = _parent._data.detect do |r_name, r_value|
        r_value == self
      end
      result = result.first if result
    else
      result = _parent._resource_name
    end
  end
  unless result
    ::Kernel.raise NameError.new "Failed to determine current resource name! (Check call location)"
  end
  if result.is_a?(::SparkleFormation::FunctionStruct)
    result = result._clone
  end
  result
end
Also aliased as: resource_name!
_system(command) click to toggle source

Execute system command

@param command [String] @return [String] result

# File lib/sparkle_formation/sparkle_attribute.rb, line 45
def _system(command)
  ::Kernel.send("`", command)
end
Also aliased as: system!
dynamic!(name, *args, &block)
Alias for: _dynamic
method!(*args)
Alias for: _method
nest!(template, *args, &block)
Alias for: _nest
puts!(*args)
Alias for: _puts
raise!(*args)
Alias for: _raise
registry!(name, *args)
Alias for: _registry
resource_name!()
Alias for: _resource_name
system!(command)
Alias for: _system