Class: SparkleFormation::SparkleStruct

Inherits:
AttributeStruct
  • Object
show all
Includes:
SparkleAttribute
Defined in:
lib/sparkle_formation/sparkle_struct.rb

Overview

SparkleFormation customized AttributeStruct

Instance Method Summary collapse

Methods included from SparkleAttribute

#_account_id, #_and, #_cf_attr, #_cf_base64, #_cf_get_azs, #_cf_join, #_cf_map, #_cf_ref, #_cf_select, #_condition, #_depends_on, #_equals, #_if, #_no_value, #_not, #_notification_arns, #_on_condition, #_or, #_platform=, #_region, #_stack_id, #_stack_name, #_stack_output, #_system, #debian?, #dynamic!, #nest!, #registry!, #rhel?, #taggable?

Constructor Details

#initialize(*_) ⇒ SparkleStruct

Override initializer to force desired behavior



12
13
14
15
16
# File 'lib/sparkle_formation/sparkle_struct.rb', line 12

def initialize(*_)
  super
  @_camel_keys = true
  _set_state :hash_load_struct => true
end

Instance Method Details

#_klassClass

Returns:

  • (Class)


43
44
45
# File 'lib/sparkle_formation/sparkle_struct.rb', line 43

def _klass
  ::SparkleFormation::SparkleStruct
end

#_self(*_) ⇒ SparkleFormation

Returns:



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sparkle_formation/sparkle_struct.rb', line 30

def _self(*_)
  unless(@self)
    if(_parent.nil?)
      ::Kernel.raise ::ArgumentError.new 'Creator did not provide return reference!'
    else
      _parent._self
    end
  else
    @self
  end
end

#_set_self(inst) ⇒ SparkleFormation

Set SparkleFormation instance

Parameters:

Returns:



22
23
24
25
26
27
# File 'lib/sparkle_formation/sparkle_struct.rb', line 22

def _set_self(inst)
  unless(inst.is_a?(::SparkleFormation))
    ::Kernel.raise ::TypeError.new "Expecting type of `SparkleFormation` but got `#{inst.class}`"
  end
  @self = inst
end

#_state(arg) ⇒ Object Also known as: state!

Override the state to force helpful error when no value has been provided

Parameters:

  • arg (String, Symbol)

    name of parameter

Returns:

  • (Object)


53
54
55
56
57
58
59
60
61
# File 'lib/sparkle_formation/sparkle_struct.rb', line 53

def _state(arg)
  result = super
  if(@self && result.nil?)
    if(_self.parameters.keys.map(&:to_s).include?(arg.to_s))
      ::Kernel.raise ::ArgumentError.new "No value provided for compile time parameter: `#{arg}`!"
    end
  end
  result
end