i'm trying to set up a list or library of sorts that holds the info for
the objects in my program. Since i am working with atoms and molecules i
know all of the possible parameters, as in an atom with an atomic number
of 1 has to be hydrogen and the abbreviation has to be H. i feel like i
can set up my initialize method to read a specified line in an outside
file and use it for the @variables. i have an idea of how the process
would go but don't know how to write it out yet. below is
what i have in mind but it should be obvious where i'm confused because
i just describe what i want in human words
class Atom
def initialize(x)
open(atom_name.txt, atom_abr.txt)readlines(x)
@atom_name = line x of atom_name.txt
@abbreviation = line x of atom_abr.txt
end
end
x will be a number 1 through 118
on 2013-02-24 00:52
on 2013-02-24 06:58
On Feb 23, 2013 5:54 PM, "Jordan G." <lists@ruby-forum.com> wrote: > > Posted via http://www.ruby-forum.com/. > Look into yaml files
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.