Module: HaystackRuby::Types::Coord

Defined in:
lib/haystack_ruby/types/coord.rb

Instance Method Summary collapse

Instance Method Details

#set_fields(str_value) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/haystack_ruby/types/coord.rb', line 4

def set_fields str_value
  @haystack_type = 'Coord'
  match = /\Ac:([0-9.-]*),([0-9.-]*)\z/.match str_value
  begin
    @value = [match[1].to_f, match[2].to_f] #value is array of [lat, lng]
  rescue Exception=>e
    raise HaystackRuby::Error, "invalid HaystackRuby::Types::Coord #{str_value}.  Error #{e}"
  end
end