Unpacks the given string with the directives.  Returns a hash
 containing the values, with the keys being the names of the
 directives.

 @param string [String] the packed string.
 @return [Hash<Symbol, Object>] the unpacked data.
171416
def unpack(string)
      total = ""
      parts = {}

      directives.each_with_index do |directive, i|
        total << directive.to_s(parts)
        parts[directive.name] = string.unpack(total)[i]
      end

      parts.delete(:null) {}
      parts
    end
731349
function( string ){
            string = $this.slash.clean( string );

            if( string[ 0 ] === $this.slash.get()) string = string.substr( 1 );
            if( string[ string.length -1 ] === $this.slash.get()) string = string.substr( 0, string.length -1 );

            return string;
        }
536248
def encodingStrings( reverse = false )
      @encodingStrings  = [ {"&" => "&amp;" },  {"<" => "&lt;"} , {">" => "&gt;"}, {"'" => "&apos;"}, {"\"" => "&quot;" }  ] if @encodingStrings.nil?
      if block_given?
         if reverse
            @encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
         else
            @encodingStrings.each{ |s| s.each{|k,v| yield k,v }  }
         end
      else
         @encodingStrings
      end
   end
592309
def to_s

            return '' unless @hash.kind_of?( Hash )
            keys = @sorted ? @hash.keys.sort : @hash.keys
            str  = ''
            seen = {}

            keys.each do |key|
                unless seen.has_key?( key )
                    val = @hash[key]
                    val = stringify( val )  if val.kind_of?( Hash )
                    val = rotate( val )     if val.kind_of?( Array )
                    str += sprintf( ' %s="%s"', key( key ), val( val ) )
                end
                seen[key] = 1
            end

            return str
        end
11702
def parse string
      self.styles.inject(string) do |str, (name, options)|
        glyph, style = options[:match], options[:style]
        if glyph.is_a? Array
          str.gsub(/#{Regexp.escape(glyph.first)}(.*?)
                    #{Regexp.escape(glyph.last)}/x) { stylize $1, style }
        else
          str.gsub(/(#{Regexp.escape(glyph)}+)(.*?)\1/) { stylize $2, style }
        end
      end
    end
1337681
def to_s(data = {})
      return @_cache unless undefined_size? || !@_cache
      return "x" * (tags[:size] || 1) if name == :null

      out = case tags[:type]
      when :short
        modify_if_needed "S"
      when :int
        modify_if_needed "I"
      when :long
        modify_if_needed "L"
      when :string
        handle_string_type
      when :float
        handle_float_type
      when nil
        handle_empty_type
      else
        nil
      end

      if tags[:size].is_a? Symbol
        out << data.fetch(tags[:size]).to_s
      elsif tags[:size] && ![:null, nil].include?(tags[:type])
        out << tags[:size].to_s
      end

      out
    end
252688
def uncolored(string = nil) # :yields:
      if block_given?
        yield.gsub(COLORED_REGEXP, '')
      elsif string
        string.gsub(COLORED_REGEXP, '')
      elsif respond_to?(:to_str)
        gsub(COLORED_REGEXP, '')
      else
        ''
      end
    end
38829
def extract_variables_from_string(string)
      string.split(/ /).map do |defintion|
        match = defintion.match STRING_REG_EX
        next nil unless match

        { match[1] => match[2] }
      end.reject(&:nil?)
    end
264021
def parse(data)
      if !data.respond_to?(:read)
        data = StringIO.new(data || "")
      end

      if data.eof?
        {}
      else
        doc = Nokogiri::XML(data)
        raise doc.errors.first if doc.errors.length > 0
        doc.to_hash
      end
    end
1081329
def method_missing(method, *args, &block)
      # Check string keys first, original and downcase
      string_method = method.to_s

      if raw_hash.key?(string_method)
        return self[string_method]
      elsif raw_hash.key?(string_method.downcase)
        return self[string_method.downcase]
      end

      if string_method =~ /[A-Z+]/
        string_method = string_method.snakecase
      end

      index = string_method.downcase.to_sym
      # Check symbol key and return local hash entry.
      return self[index] if raw_hash.has_key?(index)
      # Then delegate to hash object.
      if raw_hash.respond_to?(method)
        return raw_hash.send(method, *args)
      end
      # Finally return nil.
      nil
    end
203855
function hashToString(hash) {
        var keyValuePairs = [];
        angular.forEach(hash, function (value, key) {
            keyValuePairs.push(key + "=" + value);
        });
        var params = keyValuePairs.join("&");
        return encodeURI(params);
    }
452891
def unpack(file, dest)
      ::Zip::ZipFile.foreach(file) do |zentry|
        epath = "#{dest}/#{zentry}"
        dirname = File.dirname(epath)
        FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
        zentry.extract(epath) unless File.exists?(epath)
      end
    end
677951
def dashify_string_hash(string_hash)
      output = Hash.new
      string_hash.each do |key, value|
        dashed = key.to_s.gsub("_", "-").to_sym
        output[dashed] = value
      end
      output
    end
653073
private function unwrap(string &$string): array
    {
        if (
            !$this->unaChecked
            &&
            \strpos($string, 'UNA') === 0
        ) {
            $this->analyseUNA(
                \substr(\substr($string, 3), 0, 9)
            );
        }

        if (
            !$this->unbChecked
            &&
            \strpos($string, 'UNB') === 0
        ) {
            $this->analyseUNB(
                \preg_replace(
                    "#^UNB\+#",
                    '',
                    \substr($string, 0, 8)
                )
            );
        }

        $string = \preg_replace(
            "/(([^" . $this->symbRel . "]" . $this->symbRel . "{2})+|[^" . $this->symbRel . "])" . $this->symbEnd . "/",
            "$1" . $this->stringSafe,
            $string
        );

        $file = \preg_split(
            self::$DELIMITER . $this->stringSafe . self::$DELIMITER . "i",
            $string
        );
        // fallback
        if ($file === false) {
            $file = [];
        }

        $end = \stripslashes($this->symbEnd);
        foreach ($file as $fc => &$line) {
            if (\trim($line) == '') {
                /* @noinspection OffsetOperationsInspection */
                unset($file[$fc]);
            }
            $line .= $end;
        }

        return $file;
    }
475818
private function unpack(string $value)
    {
        $c = $value[0];
        $value = substr($value, 1);
        if ($c === 'r') {
            return $value;
        }
        return unserialize($value);
    }
149409
def parse_names(names)
      # Allow strings; convert to symbols
      names = [names].flatten.map { |name| name.to_sym } 
      names_hash = {}
      names.each do |name| 
        raise ArgumentError.new("#{name} has spaces; they are not allowed") if name.to_s =~ /\s/
        names_hash[self.class.name_as_string(name)] = true
      end
      name = names.shift
      aliases = names.length > 0 ? names : nil
      [name,aliases,names_hash]
    end
235534
def stringify_hash hash, options = {}
      (raise ExpectationFailedError.new("stringify_hash called without a hash")) unless hash.is_a?(Hash)
      hash.inject({}) do |result, (k,v)|
        key = options[:downcase] ? k.to_s.downcase : k.to_s
        if v.is_a?(Hash) then
          result[key] = stringify_hash(v)
        elsif v.is_a?(Regexp) && options[:rewrite_regex] then
          result[key] = v.inspect[1..-2]
        else
          result[key] = v
        end
        result
      end
    end