Method: Geocoder::Calculations#coordinates_present?

Defined in:
lib/geocoder/calculations.rb

#coordinates_present?(*args) ⇒ Boolean

Returns true if all given arguments are valid latitude/longitude values.

Returns:

  • (Boolean)


44
45
46
47
48
49
50
51
# File 'lib/geocoder/calculations.rb', line 44

def coordinates_present?(*args)
  args.each do |a|
    # note that Float::NAN != Float::NAN
    # still, this could probably be improved:
    return false if (!a.is_a?(Numeric) or a.to_s == "NaN")
  end
  true
end