Class: SparkleFormation::AzureVariableStruct

Inherits:
FunctionStruct
  • Object
show all
Defined in:
lib/sparkle_formation/function_struct.rb

Overview

Function struct specialized for Azure variables to check nested variable function value and properly match defined case

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from SparkleFormation::FunctionStruct

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SparkleFormation::FunctionStruct

Instance Attribute Details

#_fn_contextObject

[SparkleStruct] context of function usage



225
226
227
# File 'lib/sparkle_formation/function_struct.rb', line 225

def _fn_context
  @_fn_context
end

Instance Method Details

#_dumpObject

Wrapper to check for nested function call and properly case the function if found.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/sparkle_formation/function_struct.rb', line 237

def _dump
  # Remap nested function keys if possible
  if _fn_context && _fn_context.root!.data![_fn_name] && _fn_context.root!.data![_fn_name].data![_fn_args.first]
    __valid_keys = _fn_context.root!.data![_fn_name].data![_fn_args.first].keys!
    __current_key = @table.keys.first
    __match_key = __current_key.to_s.downcase.gsub("_", "")
    __key_remap = __valid_keys.detect do |__nested_key|
      __nested_key.to_s.downcase.gsub("_", "") == __match_key
    end
    if __key_remap
      @table[__key_remap] = @table.delete(@table.keys.first)
    end
  end
  super
end

#_klassClass

Returns:

  • (Class)


254
255
256
# File 'lib/sparkle_formation/function_struct.rb', line 254

def _klass
  ::SparkleFormation::AzureVariableStruct
end