I have several models in my app which contain several numerical
Ex.: stock model; attributes: bid, ask, value,…
todays_values_of_Google = [ [#Stock: id=1, bid = 1.5, ask = 1.5, value =
1.5, time=…, …], [#Stock: id=2, bid = 1.45, ask = 1.5, value =
Now I would like to have some statistics. I saw the possibility of open
array class and add some functions like:
def mean; blabla ; end;
But I would like to have the option of telling the attribute on which
calculate the mean.
So what would be the best practice for this as I need this on several
1.) A module? How?
def mean(array,attr); #calculate over all items of arrays
attr… ; end
2.) Modify Classes? Where to do it so all model can access the “new”
of Array (for example)
3.) Somethink else?
Thanks for any help