Class: Magiq::Types::Latitude

Inherits:
Type
  • Object
show all
Defined in:
lib/magiq/types.rb

Instance Attribute Summary

Attributes inherited from Type

#raw

Instance Method Summary collapse

Methods inherited from Type

cast, #initialize

Constructor Details

This class inherits a constructor from Magiq::Types::Type

Instance Method Details

#cast!Object



144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/magiq/types.rb', line 144

def cast!
  case v = raw.to_f
  when 0.0
    bad! "provided value of #{raw.inspect} is not permitted, it must " \
    "be a valid latitude in the range of -90.0 to 90.0"
  when -90..90
    v
  else
    bad! "provided value of #{raw.inspect} is not permitted, it must " \
    "be a valid latitude in the range of -90.0 to 90.0"
  end
end