<commit_before>require 'sparkle_formation'

class SparkleFormation

  # Provides template helper methods
  module SparkleAttribute

    # AWS specific helper implementations
    module Aws

      # @overload _cf_join(*args, opts={})
      #   Fn::Join generator
      #   @param args [String, Hash] list of items to join
      #   @param opts [Hash]
      #   @option opts [Hash] :options options for join function
      #   @option options [String] :delimiter value used for joining items. Defaults to ''
      # @return [Hash]
      def _cf_join(*args)
        options = args.detect{|i| i.is_a?(Hash) && i[:options]} || {:options => {}}
        args.delete(options)
        unless(args.size == 1)
          args = [args]
        end
        {'Fn::Join' => [options[:options][:delimiter] || '', *args]}
      end
      alias_method :join!, :_cf_join

      # Ref generator
      #
      # @param thing [String, Symbol] reference name
      # @return [Hash]
      # @note Symbol value will force key processing
      def _cf_ref(thing)
        __t_stringish(thing)
        {'Ref' => __attribute_key(thing)}
      end
      alias_method :_ref, :_cf_ref
      alias_method :ref!, :_cf_ref

      # @overload _cf_map(map_name, top_level_key, second_level_key)
      #   Fn::FindInMap generator
      #   @param map_name [String, Symbol] name of map
      #   @param top_level_key [String, Symbol, Hash] top level key name
      #   @param second_level_key [String, Symbol, Hash] second level key name
      # @return [Hash]
      def _cf_map(thing, key, *suffix)
        __t_stringish(thing)
        suffix = suffix.map do |item|
          if(item.is_a?(Symbol))
            _process_key(item, :force)
          else
            item
          end
        end
        thing = __attribute_key(thing)
        if(key.is_a?(Symbol))
          key = ref!(key)
        end
        {'Fn::FindInMap' => [thing, key, *suffix]}
      end
      alias_method :_cf_find_in_map, :_cf_map
      alias_method :find_in_map!, :_cf_map
      alias_method :map!, :_cf_map

      # @overload _cf_attr(logical_id, attribute_name)<commit_msg>Implemented import_value.<commit_after>require 'sparkle_formation'

class SparkleFormation

  # Provides template helper methods
  module SparkleAttribute

    # AWS specific helper implementations
    module Aws

      # @overload _cf_join(*args, opts={})
      #   Fn::Join generator
      #   @param args [String, Hash] list of items to join
      #   @param opts [Hash]
      #   @option opts [Hash] :options options for join function
      #   @option options [String] :delimiter value used for joining items. Defaults to ''
      # @return [Hash]
      def _cf_join(*args)
        options = args.detect{|i| i.is_a?(Hash) && i[:options]} || {:options => {}}
        args.delete(options)
        unless(args.size == 1)
          args = [args]
        end
        {'Fn::Join' => [options[:options][:delimiter] || '', *args]}
      end
      alias_method :join!, :_cf_join

      # Ref generator
      #
      # @param thing [String, Symbol] reference name
      # @return [Hash]
      # @note Symbol value will force key processing
      def _cf_ref(thing)
        __t_stringish(thing)
        {'Ref' => __attribute_key(thing)}
      end
      alias_method :_ref, :_cf_ref
      alias_method :ref!, :_cf_ref

      # ValueImport generator
      #
      # @param thing [String, String] value import
      # @return [Hash]
      def _cf_value_import(thing)
        __t_stringish(thing)
        {'Fn::ImportValue' => __attribute_key(thing)}
      end
      alias_method :_import_value, :_cf_value_import
      alias_method :import_value!, :_cf_value_import

      # @overload _cf_map(map_name, top_level_key, second_level_key)
      #   Fn::FindInMap generator
      #   @param map_name [String, Symbol] name of map
      #   @param top_level_key [String, Symbol, Hash] top level key name
      #   @param second_level_key [String, Symbol, Hash] second level key name
      # @return [Hash]
      def _cf_map(thing, key, *suffix)
        __t_stringish(thing)
        suffix = suffix.map do |item|
          if(item.is_a?(Symbol))
            _process_key(item, :force)
          else
            item
          end
        end
        thing = __attribute_key(thing)
        if(key.is_a?(Symbol))
          key = ref!(key)
        end
        {'Fn::FindInMap' => [thing, key, *suffix]}
      end
      alias_method :_cf_find_in_map, :_cf_map
      alias_method :find_in_map!, :_cf_map
      alias_method :map!, :_cf_map

      # @overload _cf_attr(logical_id, attribute_name)
{'fraction_non_alphanumeric': 0.10915032679738562, 'fraction_numerical': 0.00043572984749455336, 'mean_word_length': 2.398223538119911, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3512372', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1429, 'n_words': 372}