--1926193751-172375279-1208959058933 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-172375279-1208959058=:2933" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-172375279-1208959058933 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Tue, 22 Apr 2008, Tim Wolak wrote: > Morning all, > > I sent an email on this yesterday and needed to give you guys some example > code. Below is some code I have for grabbing the numbers I need from lines > in a text file that we receive via FTP. My big concern is the negative > numbers for accounts which are indicated by a position in the file where 0 > is a postive number and is a negative number. What is the best way toet > my account balance and make it a negative number? I¥±m not sure I¥±m doing it > the correct way in this script. > > class Info > attr_reader :acct, :money > > def initialize(filename) > @acct = File.new(filename, "r") > end > f = Info.new("Balances20080415.txt") It's extremely unusual (I don't think I've ever seen it) to put instantiation and scripting code (for lack of a better term) inside a class definition. It will get executed, but it's really odd-looking :-) Question: Can you provide some sample lines of input? I can't quite get a fix on what the lines look like. I'm wondering whether scanf might help you. David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates! --1926193751-172375279-1208959058933-- --1926193751-172375279-1208959058933--