On Sat, Mar 9, 2013 at 10:05 PM, Joel Pearson <[email protected]> wrote:
> Wow! Lots of good advice, as usual :) It'll take me a while to process
> all this so I'll just get on with it.

I have attached the skeleton of a class for spreadsheet storage to
illustrate what I was saying earlier.  Note for example that this
class does not have textual cell indexes.  I thought it might be
easier to use int ranges when focusing on the basic manipulations
which will move cells.  Depending on storage chosen that may be tricky
enough already.

A next step could be to create a subclass which allows for
CellReferences to register with the class and have them automatically
update on successful move operations.  I do not know whether you need
that but when trying to recreate a spreadsheet application in Ruby
that might be an interesting feature to have.

As step towards the user your spreadsheet class could wrap the storage
class and translate indexes back and forth so the user of your class
would only see addresses like "A4" instead of [0, 3].

> Incidentally, I hadn't seen this before:
> http://ruby-doc.org/stdlib-1.9.3/libdoc/csv/rdoc/CSV/Table.html
> It looks similar in many ways to what I'm trying to build. I'll have to
> see what I can learn from it as well.

Yes, but keep in mind that CSV has a different mental model: in CSV a
row is typically a record, so all the data in a row belongs together.
In a spread sheet both dimensions are much more equal.  With CSV you
won't do operations like inserting a rectangular area somewhere in
between while that could be quite common with spread sheets.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- 
[email protected] | 
https://groups.google.com/d/forum/ruby-talk-google?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Attachment: spread-store.rb
Description: Binary data

Reply via email to