Good point
On Jun 27, 2013, at 2:02 PM, Kelley Reynolds <notifications@github.com> wrote:

> In lib/mios/device.rb:
> 
> > @@ -65,7 +69,8 @@ def parse(data, skip_attributes=false)
> >        
> >        @states = data['states']
> >        @states.map { |state|
> > -        state['service'].split(":").last
> > +        parts = state['service'].split(":")
> You can just put this all inline, it's still pretty readable, like so:
> 
> state['service'].split(":").select { |el| el !~ /^\d+$/ }.last
> In this case though, I'm think what we actually want to do is concatenate the last two if the last one is just a number. In the future, I think there may be other versions of things (:2 etc) that may need other implementations. So for this one, maybe it should be something more like
> 
> parts = state['service'].split(":")
> parts.last =~ /^\d+$/ ? parts[-2..-1].join : parts[-1]
> How does that sound?
> 
> —
> Reply to this email directly or view it on GitHub.
>