Code Monkey home page Code Monkey logo

Comments (6)

geemus avatar geemus commented on August 15, 2024

Hmm. I think I'd be ok with something like this, but the second argument is already used for limiting the fields including (and is an array). So we probably shouldn't just replace it with a hash. Maybe we could do it where each thing in that array can be a string to just include the key or a one keypair hash to remap it. So your example would be like:

Formatador.display_table(table_data, [{"name": "Name"}, {"meal.drink": "Drink"}])

What do you think? Thanks!

from formatador.

michaelmior avatar michaelmior commented on August 15, 2024

I wasn't suggesting replacing that argument. I was just suggesting allowing either a hash or array to be passed. Although your suggestion of an array of hashes works as well :)

from formatador.

geemus avatar geemus commented on August 15, 2024

AH. Yeah, that makes sense. I think maybe I would prefer array or hash (vs array of hashes) in that case. Array of hashes is weird...

from formatador.

michaelmior avatar michaelmior commented on August 15, 2024

However, is the order if iteration over key-value pairs in hashes defined in Ruby? If not and you use a hash (instead of an array of hashes) then you lose the ability to reliably define the order of output fields.

from formatador.

geemus avatar geemus commented on August 15, 2024

Ah, yeah, good call. hash keys are not ordered, so perhaps array-of-hashes is worthwhile after all. It has the added side-benefit that you can more simply include the non-translated keys too.

from formatador.

github-actions avatar github-actions commented on August 15, 2024

This issue has been marked inactive and will be closed if no further activity occurs.

from formatador.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.