From: Martin DeMello Date: 2009-04-22T07:37:10+09:00 Subject: Re: Spreadsheet development On Wed, Apr 22, 2009 at 4:00 AM, Ahmed Abdelsalam wrote: > Hi,... > > I'd like to create a Spreadsheet model, where I can access cells like > the following: > > sheet = Spreadsheet.new > sheet.cells.a1 = 'Hello' > sheet.cells.b3 = 'World' > > The problem is in how to define cell names to be accessed in the above > manner? > > Any help? method_missing should do it irb(main):001:0> class Cells irb(main):002:1> def method_missing(meth, *args) irb(main):003:2> print "you tried to access cell #{meth}" irb(main):004:2> end irb(main):005:1> end irb(main):006:0> cells = Cells.new irb(main):007:0> cells.a1 you tried to access cell a1 martin