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
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
@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
@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
@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
@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
Raise an exception @see Kernel.raise
# File lib/sparkle_formation/sparkle_attribute.rb, line 64 def _raise(*args) ::Kernel.raise(*args) end
@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
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
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