slurp a file into an array without newlines

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

  1. Dick Davies

    Dick Davies Guest

    Coffee....not.....working.......

    what's a neater way of doing this?

    lines =3D File.new('sometextfile').readlines.map { |l| l.chomp }
     
    Dick Davies, Sep 29, 2005
    #1
    1. Advertisements

  2. require 'rio'

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

    Gavin
     
    Gavin Sinclair, Sep 29, 2005
    #2
    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.