[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: numbers of a record in an array

Paul Danese

4/1/2008 12:33:00 PM

Frequency exists in 2.4.0, but there appear to be some path problems w/
2.4.0.

Try uninstalling 2.4.0 and installing 2.3.0 instead.

-----Original Message-----
From: jzakiya [mailto:jzakiya@mail.com]=20
Sent: Friday, March 28, 2008 11:40 AM
To: ruby-talk ML
Subject: Re: numbers of a record in an array

On Mar 27, 10:51 am, Paul Danese <pdan...@Rib-x.com> wrote:
> If you install the facets gem you can use "frequency"
>
> e.g.
>
> >irb
>
> irb:> require 'rubygems'
> =3D> false
> irb:> require 'facets'
> =3D> true
> irb:> x =3D %w[a b d e e rkeke ele e ee e e el d]
> =3D> ["a", "b", "d", "e", "e", "rkeke", "ele", "e", "ee", "e", "e",
"el",
> "d"]
> irb:> x.frequency
> =3D> {"ee"=3D>1, "a"=3D>1, "b"=3D>1, "d"=3D>2, "e"=3D>5, "el"=3D>1,=
"ele"=3D>1,
> "rkeke"=3D>1}
>

I installed facets 2.4.0 (the current latest) and tried to use the
'frequency' method shown in this example, but in doesn't exist in this
version of facets.

I did 'ri facets' and it only returned 'Enumerable#frequency'
This is using Linux (PCLOS) and Ruby 1.8.6-p114.

What version of facets does the 'frequency' method exist in, because
it isn't in version 2.4.0?



=0AThis email and any attached files are confidential and intended solel=
y for the intended recipient(s). If you are not the named recipient you=
should not read, distribute, copy or alter this email. Any views or opi=
nions expressed in this email are those of the author and do not represe=
nt those of the company. Warning: Although precautions have been taken=
to make sure no viruses are present in this email, the company cannot=
accept responsibility for any loss or damage that arise from the use=
of this email or attachments.