Module: SparkleFormation::SparkleAttribute
- Included in:
- SparkleStruct, Translation
- Defined in:
- lib/sparkle_formation/sparkle_attribute.rb,
lib/sparkle_formation/sparkle_attribute/aws.rb,
lib/sparkle_formation/sparkle_attribute/heat.rb,
lib/sparkle_formation/sparkle_attribute/azure.rb,
lib/sparkle_formation/sparkle_attribute/rackspace.rb
Overview
Provides template helper methods
Defined Under Namespace
Modules: Aws, Azure, Heat, Rackspace
Instance Method Summary collapse
-
#__attribute_key(key) ⇒ String
Format the provided key.
-
#_method(*args) ⇒ Method
(also: #method!)
Lookup a method definition on self usually used as ‘puts! method!(:foo).source_location`.
-
#_puts(*args) ⇒ NilClass
(also: #puts!)
Print to stdout.
-
#_raise(*args) ⇒ Object
(also: #raise!)
Raise an exception.
-
#_resource_name ⇒ String
(also: #resource_name!)
Return current resource name.
-
#_system(command) ⇒ String
(also: #system!)
Execute system command.
-
#dynamic!(name, *args, &block) ⇒ self
Dynamic insertion helper method.
-
#nest!(template, *args, &block) ⇒ self
Stack nesting helper method.
-
#registry!(name, *args) ⇒ self
Registry insertion helper method.
Instance Method Details
#__attribute_key(key) ⇒ String
Format the provided key. If symbol type is provided formatting is forced. Otherwise the default formatting is applied
100 101 102 103 104 105 106 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 100 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 |
#_method(*args) ⇒ Method Also known as: method!
Lookup a method definition on self usually used as ‘puts! method!(:foo).source_location`
62 63 64 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 62 def _method(*args) ::Kernel.instance_method(:method).bind(self).call(*args) end |
#_puts(*args) ⇒ NilClass Also known as: puts!
Print to stdout
48 49 50 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 48 def _puts(*args) $stdout.puts(*args) end |
#_raise(*args) ⇒ Object Also known as: raise!
Raise an exception
54 55 56 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 54 def _raise(*args) ::Kernel.raise(*args) end |
#_resource_name ⇒ String Also known as: resource_name!
Return current resource name
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 16 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 result end |
#_system(command) ⇒ String Also known as: system!
Execute system command
39 40 41 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 39 def _system(command) ::Kernel.send('`', command) end |
#dynamic!(name, *args, &block) ⇒ self
Dynamic insertion helper method
72 73 74 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 72 def dynamic!(name, *args, &block) SparkleFormation.insert(name, self, *args, &block) end |
#nest!(template, *args, &block) ⇒ self
Stack nesting helper method
90 91 92 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 90 def nest!(template, *args, &block) SparkleFormation.nest(template, self, *args, &block) end |
#registry!(name, *args) ⇒ self
Registry insertion helper method
81 82 83 |
# File 'lib/sparkle_formation/sparkle_attribute.rb', line 81 def registry!(name, *args) SparkleFormation.registry(name, self, *args) end |