Sha256: defe812d848cbc3f9377bbfc7c8fad5fe21415f168670bb996c12571a84d39ce

Contents?: true

Size: 381 Bytes

Versions: 4

Compression:

Stored size: 381 Bytes

Contents

# Checks if the value of an attribute is a valid longitude value.
#
# @example Validate that the device latitude is valid.
#   class Device << ActiveRecord::Base
#     attr_accessor :latitude
#     validates :latitude, latitude: true
#   end
class LatitudeValidator < BaseValidator
  private

  def valid?(latitude, _)
    latitude.present? && latitude.between?(-90, 90)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
missing_validators-2.3.0 lib/missing_validators/validators/latitude_validator.rb
missing_validators-2.2.0 lib/missing_validators/validators/latitude_validator.rb
missing_validators-2.1.0 lib/missing_validators/validators/latitude_validator.rb
missing_validators-2.0.0 lib/missing_validators/validators/latitude_validator.rb