Giter Club home page Giter Club logo

Comments (4)

spider-network avatar spider-network commented on June 27, 2024

+1

from tty-table.

piotrmurach avatar piotrmurach commented on June 27, 2024

Hi Michael,

I would really appreciate contribution from your side, even discussion of the api would be a huge step forward. Since you would like this feature implemented I assume you have an idea of how it should work.

I haven't spent much time thinking about the implementation but using my UML skills, this is what I believe the implemntation should behave like:
table_data_streaming

Currently TTY::Table is just a data structure with fairly elaborate way of rendering that data set back as formatted string. There is no notion of stream or partial rendering. Based on the above, we would need to have a way to inject a stream to table, keep it open when the data starts streaming, continue sending messages back to the stream and close it once done. The hard part is to write good api for that, for starters I would suggest the following:

table = TTY::Table.new(stream: 'some stream type such as stdout or file descriptor')
table.on_open do |stream, header|
   stream.puts header
end
table.on_receive_data do |stream, formatted_data_rows|
   stream.puts formatted_data_rows
end
table.on_close do |stream, footer|
   stream.puts footer
   stream.close
end
table.render_to_stream

# initial few data rows
table.chunk data
# some time later add few more rows
table.chunk data

Please let me have your thoughts!

from tty-table.

moortimis avatar moortimis commented on June 27, 2024

I've stumbled across this project in hope of achieving exactly what Peter has described above.

I'd be interested in any feedback or direction you could provide on how this can be achieved using TTY::Table.

Thanks in advance.

from tty-table.

piotrmurach avatar piotrmurach commented on June 27, 2024

@moortimis This hasn't been implemented yet in this library. I was hoping for discussion and review of my initial thoughts. Do you have an example of how you would like the streaming API to work? Would you mind commenting on my outline?

from tty-table.

Related Issues (20)

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.