Traject context.output_hash values are arrays.
 turn them into good column values, joining strings if needed.

 Single values also accepted, even though not traject standard, they
 will be passed through unchanged.
320045
def output_value_to_column_value(v)
      if v.kind_of?(Array)
        if v.length == 0
          nil
        elsif v.length == 1
          v.first
        elsif v.first.kind_of?(String)
          v.join(@internal_delimiter)
        else
          # Not a string? Um, raise for now?
          raise ArgumentError.new("Traject::SequelWriter, multiple non-String values provided: #{v}")
        end
      else
        v
      end
    end
877911
def print_hash(key, value)
      if value.length > @width
        print_long_string value, "#{key}:"
      else
        print "#{key}:", value.cyan
      end
    end
260005
def get_output_values(self):
        
        # Handle primitive values here and implicitly convert them to a dict because
        # it allows the API to be simpler.

        # Also influxDB mandates that each value also has a name so the default name
        # for any non-dict value is "value"
        if not isinstance(self.values, dict):
            metric_values = {'value': self.values}
        else:
            metric_values = self.values

        # Sort the values in lexicographically by value name
        sorted_values = sorted(metric_values.items())

        # Remove None values
        sorted_values = [(k, v) for k, v in sorted_values if v is not None]

        return u",".join(u"{0}={1}".format(format_string(k), format_value(v)) for k, v in sorted_values)
496657
function(arg_hash){

	if( ! arg_hash ){ arg_hash = {}; }
	var out_keys = [];
	for (var out_key in arg_hash) {
	    if (arg_hash.hasOwnProperty(out_key)) {
		out_keys.push(out_key);
	    }
	}
	
	return out_keys;
    }
17615
def WriteFileHash(self, path, hash_value):
    
    string = '{0:s}\t{1:s}'.format(hash_value, path)

    encoded_string = self._EncodeString(string)
    print(encoded_string)
564070
def parse_hash
      direction = clause.values.first
      field = clause.keys.first.to_s
      ["$order_by", ["$#{direction}", field]]
    end
997384
def columns_to_hash(valid_columns, columns, keys_case=:underscore)
			raise Exception.new("Invalid time value: nil") if columns.nil?
			
			key = self.class.to_s.demodulize.gsub(/ReportRequest/, 'ReportColumn')
			return { key => 
					columns.map do |col|
						if col.is_a?(String)
							col
						elsif col.is_a?(Symbol)
							valid_columns[col.to_s]
						end
					end
				}
		end
812032
def build_mapping(values)
      {}.tap do |hash|
        values.each_with_index { |key, index| hash[key] = (0b1 << index) }
      end
    end
681837
def to_hash
      result = {}
      @lines.entries.each do |section|
        result[section.key] ||= {}
        section.entries.each do |option|
          opts = Array(option)
          val = opts.map { |o| o.respond_to?(:value) ? o.value : o }
          val = val.size > 1 ? val : val.first
          result[section.key][opts.first.key] = val
        end
      end
      result
    end
1154728
def map_array_of_hashes(arr_hashes)
      return if arr_hashes.nil?

      [].tap do |output_array|
        arr_hashes.each do |hash|
          output_array.push hash.values
        end
      end
    end
142102
def to_hash
      hash = {}
      each_pair do |key, value|
        if value.kind_of?(ConfigHash)
          value = value.to_hash
        end
        
        hash[key] = value
      end
      hash
    end
1242515
def join! datastream
      left = self.data
      right = datastream.data
      columns = self.headers & datastream.headers

      raise NullJoin, 'Datastreams do not share any column' if columns.empty?

      left_groups  = Hash.new { |hash, key| hash[key] = [] }
      right_groups = Hash.new { |hash, key| hash[key] = [] }

      left.each do |row|
        values = columns.map { |column| row[column] }

        left_groups[values] << row unless values.include? nil
      end

      right.each do |row|
        values = columns.map { |column| row[column] }

        right_groups[values] << row unless values.include? nil
      end

      output = []

      left_groups.each do |key, left_group|

        if right_group = right_groups[key]

          left_group.each do |left_tuple|
            right_group.each do |right_tuple|
              output << left_tuple.merge(right_tuple)
            end
          end

        end
      end

      # TODO: I do not like this. Why a datastream's data could be
      # modified directly? Anyway, #join! is likely to be reimplemented
      # many times as more features are added. It will improve.
      self.data = output
      self
    end
796429
def value_map(value)
      v = case value.class
      when Array
        value.join(',')
      when Range
        "#{value.first}-#{value.last}"
      when Hash
        if value.has_key?(:or)
          "|#{value[:or].join(',')}"
        elsif value.has_key?(:not)
          "~#{value[:not].join(',')}"
        end
      when TrueClass
        "Y" # TODO: figure out if this should be Y or Yes
      when FalseClass
        "N" # TODO: figure out if this should be N or No
      else
        value
      end
      v
    end
1232671
def values(key)
      h = hash(key)

      hoff = @hashes[(h % 256)*2]
      hlen = @hashes[(h % 256)*2 + 1]

      return [] if hlen == 0
      off = (h / 256) % hlen

      vals = []

      # FIXME: Is this potentially an infinite loop (if full)?
      # Easy to avoid by exiting if off reaches the same value twice.

      while
          (slot = read(hoff + off * hashref_size .. hoff + off * hashref_size + hashref_size - 1)) &&
          (dslot = ary_unpack(slot,2)) && dslot[1] != 0

        if dslot[0] == h
          pos = dslot[1]

          rkey, value = read_entry(pos)
          if rkey == key
            vals << value
          end
        end
        off = (off + 1) % hlen
      end
      return vals
    end
909900
def output(data = {}, indent = 0)
      case @options['format']
      when 'json'
        puts JSON.pretty_generate(data)
      when 'yaml'
        puts data.to_yaml
      else
        # rubocop:disable Metrics/BlockNesting
        if data.class == Hash
          data.each do |k, v|
            if v.class == Hash || v.class == Array
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}:"
              output(v, indent + 2)
            else
              puts "#{' ' * indent}#{k.nil? ? 'nil' : k}: #{v.nil? ? 'nil' : v}"
            end
          end
        elsif data.class == Array
          data.each do |d|
            if d.class == Hash || d.class == Array
              output(d, indent + 2)
            else
              puts "#{' ' * indent}#{d.nil? ? 'nil' : d}"
            end
          end
          puts "\nTotal: #{data.size}" if indent < 1
        else
          puts "#{' ' * indent}#{data.nil? ? 'nil' : data}"
        end
        # rubocop:enable Metrics/BlockNesting
      end
    end
144619
private static function dumpArray($value)
	{
		// array
		if ($value && !self::isHash($value)) {
			$output = [];
			foreach ($value as $val) {
				$output[] = self::dump($val);
			}

			return \sprintf('[%s]', \implode(', ', $output));
		}

		// hash
		$output = [];
		foreach ($value as $key => $val) {
			$output[] = \sprintf('%s: %s', self::dump($key), self::dump($val));
		}

		return \sprintf('{ %s }', \implode(', ', $output));
	}
31477
def to_h
      hash = {}
      @data.each_pair do |key, value|
        hash[key] = value.to_h
      end
      
      hash      
    end