From: Brandon Weaver Date: 2012-12-28T07:32:21+09:00 Subject: Re: numeric? --f46d042fd93aabac7d04d1dd1e53 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sorry, I wasn't very clear. I was typing most of that from my Phone. I'm writing scripts for a wireless ISP, and we use several different types of antennas. They're monitored in several different ways, SSH/Telnet/SNMP/etc. Annoyingly they all return different values for null, but they're always string based, so a numeric evaluation will quickly yield whether the device is working or down. I could write a more correct solution in the sense that it's less of a hack with individual classes for every antenna, but the goal is that if we ever get a new type of equipment that it will take minimal coding to get a framework up and running for it. The main concept here is making the code as DRY as possible, and to abstract the testing as far from the hardware as possible so as to give more general statistics for the entire network. I'm not particularly good at articulating this one. One such example is min, max, and avg for multiple fields such as Signal to Noise, Retransmit, and etc. I used instance_variable_get to dynamically evaluate fields. There are ways in which I could probably use more of Enumerator, and I still need to sort that out some more. On Thu, Dec 27, 2012 at 4:13 PM, Dami=E1n M. Gonz=E1lez wrote: > I think we need more information, the return values are fixeds? what are > they? > > -- > Posted via http://www.ruby-forum.com/. > > --f46d042fd93aabac7d04d1dd1e53 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sorry, I wasn't very clear. I was typing most of that from my Phone.
I'm writing scripts for a wireless ISP, and we use sev= eral different types of antennas. They're monitored in several differen= t ways, SSH/Telnet/SNMP/etc. Annoyingly they all return different values fo= r null, but they're always string based, so a numeric evaluation will q= uickly yield whether the device is working or down. I could write a more co= rrect solution in the sense that it's less of a hack with individual cl= asses for every antenna, but the goal is that if we ever get a new type of = equipment that it will take minimal coding to get a framework up and runnin= g for it.

The main concept here is making the code as DRY as poss= ible, and to abstract the testing as far from the hardware as possible so a= s to give more general statistics for the entire network. I'm not parti= cularly good at articulating this one.

One such example is min, max, and avg for multiple fiel= ds such as Signal to Noise, Retransmit, and etc. I used instance_variable_g= et to dynamically evaluate fields. There are ways in which I could probably= use more of Enumerator, and I still need to sort that out some more.

On Thu, Dec 27, 2012 at 4:13 PM, Dami=E1n M.= Gonz=E1lez <lists@ruby-forum.com> wrote:
I think we need more information, the return values are fixeds? what are they?

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


--f46d042fd93aabac7d04d1dd1e53--