[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Spreadsheet development

Ahmed Abdelsalam

4/21/2009 10:31:00 PM

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?

Thanks

Ahmed
--
Posted via http://www.ruby-....

4 Answers

Martin DeMello

4/21/2009 10:37:00 PM

0

On Wed, Apr 22, 2009 at 4:00 AM, Ahmed Abdelsalam <ahmed@amanzitel.com> 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

Ahmed Abdelsalam

4/22/2009 11:37:00 AM

0

Martin DeMello wrote:
> On Wed, Apr 22, 2009 at 4:00 AM, Ahmed Abdelsalam <ahmed@amanzitel.com>
> wrote:
>> 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

Thanks martin for your response. I've tried it with ruby and it's OK.
Actually my objective is to run it with JRuby, but the same code is
giving error:
at (unknown).(unknown)(Unknown Source)
at #<Class:01x114025>.method_missing(<unknown>:1)
at (unknown).(unknown)(:1)

Any suggestion?

Regards,..

Ahmed
--
Posted via http://www.ruby-....

Mark Thomas

4/22/2009 12:17:00 PM

0


> Thanks martin for your response. I've tried it with ruby and it's OK.
> Actually my objective is to run it with JRuby, but the same code is
> giving error:
> at (unknown).(unknown)(Unknown Source)
>   at #<Class:01x114025>.method_missing(<unknown>:1)
>   at (unknown).(unknown)(:1)
>
> Any suggestion?

Upgrade? There were problems with method_missing in older versions of
JRuby. I don't know what version you're using, but I would suggest
1.2.

-- Mark.

Ray O'Hara

11/11/2011 8:03:00 PM

0


"dr.narcolepsy" <jminpa@gmail.com> wrote in message
news:23323561.3051.1321021641400.JavaMail.geo-discussion-forums@yqbl36...
> On Friday, November 11, 2011 12:03:33 AM UTC-5, Ray O'Hara wrote:
>>> "dr.narcolepsy" <jmi...@gmail.com> wrote in message
>>> the first set, and then doing sets of 7, after that. I'm desperate to
>>> figure out a way to build my ability to do more in one set . . .
>
>> do them in a room with a higher ceiling.
>
> That is a good idea, Ray. I don't have a room with a higher ceiling, but
> I could sure do one more short set, outside, and jump as high as I can

Bart Star would be proud of you, it was his favorite exercise.