Eivind Eklund wrote:
> On Fri, Apr 4, 2008 at 5:41 AM, Michael Linfield 
> <globyy3000 / hotmail.com> wrote:
> [... about a way to map a range to a specific value ...]
> 
>>  However! The file that I'll be importing will probably contain a large
>>  amount of traffic being pushed at RangedHash.new
> 
> I smell premature optimization, under the terms "probably" and "large".
> 
> 
>>and you'd have to do a post-readperfect hash construction - basically, you'd >>have to define your ranges up front and then dynamically create a hash function >>from it.
> 
> Eivind.

Precisely what I did. Knowing there was no way to actual construct a 
hash needing the format I did within say IRB, I created a basic file 
utilizing the hash structure, then imported it as a whole literal.

>if you want to make them 
>perform different than from what every coder knows them to be, then at 
>least have the courtesy to change the class name..

I completely agree and plan to change that class name now that its been 
brought to my attention.

A more 'correct' approach to this scenario would be of course to use an 
SQL database and deal with the ranges in that matter, but theres always 
the challenge of how to do it different than everyone else ;)

- Mac
-- 
Posted via http://www.ruby-forum.com/.