slurp a file into an array without newlines

Discussion in 'Ruby' started by Dick Davies, Sep 29, 2005.

  1. Dick Davies

    Dick Davies Guest


    what's a neater way of doing this?

    lines =3D'sometextfile') { |l| l.chomp }
    Dick Davies, Sep 29, 2005
    1. Advertisements

  2. require 'rio'

    lines = rio('sometextfile').chomp.lines[]

    Gavin Sinclair, Sep 29, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.