jgillick / ruby-serialgps

Provides an easy API to get GPS data from your serial GPS module.
13 stars 6 forks source link

fix for modern ruby version #1

Closed qume closed 7 years ago

qume commented 8 years ago

on line 140 change

        if c == 10
            buffer.lstrip!

to

        if c.ord == 10
            buffer.lstrip!

to make this gem work. I don't know for sure but assume that this worked 7 years ago on a previous version of ruby then they changed how the comparison operator works with chars

Thanks for a great gem!

qume commented 8 years ago

Actually this might work better - helps catch some UTF8 issues (why there are any I don't understand):

if c == "\n" buffer = buffer.encode("ASCII") buffer.lstrip!