-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Description
Hello,
I got the following error by starting from TUI.
geotoad.rb:186:in 'GeoToad#getoptions': undefined method '=~' for an instance of Integer (NoMethodError)
So I'm not so familiar wih ruby, but at least I'm into software development. So I asked the AI:
This means Ruby is trying to use the =~ operator (used for regex matching) on an integer, but =~ only works on strings.
``
# distanceMax from command line can contain the unit
@distanceMax = @option['distanceMax'].to_f
if @distanceMax == 0.0
@distanceMax = 10
end
if @option['distanceMax'] =~ /(mi|km)/
@useMetric = ($1 == "km" || nil)
# else leave usemetric unchanged
end
I'm not familiar with the type of distanceMax in the @options but it seems like some type error.
The recommended solution was to convert the @option['distanceMax'] to a string, which worked for me.
# distanceMax from command line can contain the unit
@distanceMax = @option['distanceMax'].to_f
if @distanceMax == 0.0
@distanceMax = 10
end
if @option['distanceMax'].to_s =~ /(mi|km)/
@useMetric = ($1 == "km" || nil)
# else leave usemetric unchanged
end