that file 1.txt contains
name,contact_no,city,gender,more attributes...
xyz,2014567894,NY,M.....
MNO,2014587965,Chicago,Female....
....,...,...,...,....,.............
like wise we can have any number of attributes in file and its value
its like a table.
name contact city gender attribute1 attribute
2....attri n
M 890 NY Male value1 value2
value n
etc....
now I have created a class
class File
def self.find(name,args)
#i do splitting
# instance_eval "define_method(key) { value}"
end
end
f1=File.find("name","M")
f1.name# this gives the name of the person.
f1.city #this gives the name of the city.
--
Posted via http://www.ruby-forum.com/.