From: Marnen Laibow-Koser Date: 2010-02-06T04:52:37+09:00 Subject: Re: Area Codes Wood Yee wrote: > Hi! TOTAL noob question here but that's what I am. I'm trying to create > a program where I type the area code, hit enter, and see it's state. I > have a list of codes per state and it's rather large. How's the best way > to do this? I don't want to use a database (MySQL) for this if that's > possible. I've tried using if statements and hashes but didn't know if > there's a better way. I've searched for a gem that's already written but > didn't have any luck and I've googled to see if there's source code for > this already but couldn't find anything. Any ideas? Thanks! Use a database (if this is a desktop application, SQLite would work well; if you're using JRuby, try H2). It's the best way. If you use one of the many excellent ORM libraries (ActiveRecord, Sequel, DataMapper...), this is quite easy. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.