Project

General

Profile

Actions

Bug #16943

closed

Incorrect Behaves on Hash-From-Pair-Array

Bug #16943: Incorrect Behaves on Hash-From-Pair-Array

Added by christian.gogo2014 (Chistian Y.) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:98696]

Description

Just realized I repeated some columns on @header, that's why transpose was overwriting some places.

Thanks, this can be closed!

[Solved] ---------------------------------

Please considere the follow example

@header = ["CONSECUTIVO", "ESTATUS", "ID", "NOMBRE COMERCIAL", "SUCURSAL", "UBICACIÓN", "EQUIPO", "CALLA", "NUMERO EXTERIOR", "NUMERO INTERIOR", "REFERENCIA", "COLONIA", "C P", "MUNICIPIO", "CIUDAD", "ESTADO", "CONTACTO SUCURSAL", "TELEFONO", "CORREO ELECTRONICO", "VENDEDOR ACTUAL", "FECHA DE INSTALACIÓN", "ESTATUS DE FACTURACIÓN", "ID CLIENTES", "RAZÓN SOCIAL", "RFC", "CALLE", "NÚMERO", "COLONIA", "DELEGACIÓN", "C P", "CIUDAD", "PRECIO ACORDADO", "SF_PRESENT"]

@spreadsheet = ["151", "Cancelado", "KA70200161", "IPQ QUERETARO", "Pirineos #535", "Planta", "DBT", "Pirineos", "535", "1 y 2", nil, "Zona Industrial Benito Juárez", "76120", "Santiago de Querétaro", "Querétaro", "Querétaro", "Oscar Romero ", "442 496 6366", "-", "Jaser Asahel Galicia Velazquez", "12/07/2017", "Cancelado", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]

array = [header, @spreadsheet].transpose

new_hash = Hash[array]

Expected Behaves ----------------------

new_hash["C P"] == "76120"
=> true

Result on -----------------------------

  • ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
  • ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin15]

new_hash["C P"]
=> nil

Thanks in advance!

Actions

Also available in: PDF Atom