[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Help with some codes

Rufina Paris

10/12/2008 10:44:00 AM

heya all!

well, am such a newbies in this world of ruby language, though! i found
it very interesting language and i am pretty much can catch up myself
but not as fast as i've thought. anyway, below are some source code
which i need some alternation to make it loop and adding 'while'
statement...anybody could have something to say??

regards

Attachments:
http://www.ruby-...attachment/2804/...

--
Posted via http://www.ruby-....

2 Answers

Rüdiger Brahns

10/12/2008 11:27:00 AM

0


Do you mean mac_conf.each_with_index { |mac, aplist|...?

Brian Candler

10/12/2008 7:30:00 PM

0

Ingrid paris wrote:
> heya all!
>
> well, am such a newbies in this world of ruby language, though! i found
> it very interesting language and i am pretty much can catch up myself
> but not as fast as i've thought. anyway, below are some source code
> which i need some alternation to make it loop and adding 'while'
> statement...anybody could have something to say??
>
> regards

I think your problem line should be changed to

macaddr.each { |mac, aplist| puts "\n ALERT!\t\n An Imitation of MAC
address
#{mac} were found >> #{aplist.inspect}" if aplist.size > 1}

(Note in particular that you iterate over the hash 'macaddr', not the
closed IO object mac_conf, and since aplist is an array you need to
check aplist.size)
--
Posted via http://www.ruby-....