[Rails] Hash table

2015-12-16 Thread Suo Huang
Hi all, I am a newbie in Ruby, and I am having a small question with the hash table. If anyone could give me some suggestions that would be great! Considering creating a hash table like this: a_Min a_Max b_Min b_Max p1 p2 p3p4 p5 p6

Re: [Rails] Hash table

2015-12-16 Thread Scott Eisenberg
Looks to me like you will have an Array of hashes. The ruby way something like a single line array select t.select{|tt| a.between?(tt[:min], tt[:max]) && b.between?(tt[:b_min], tt[:b_max])} create the array initially with something like t = Array.new t << {a_min: 1, a_max:10, b_min: 100,

Re: [Rails] Hash table

2015-12-16 Thread Rob Biedenharn
> On 2015-Dec-16, at 17:24 , Scott Eisenberg wrote: > > Looks to me like you will have an Array of hashes. > > The ruby way something like a single line array select > > t.select{|tt| a.between?(tt[:min], tt[:max]) && b.between?(tt[:b_min], > tt[:b_max])} > > create