<commit_before>require "rgeo/geo_json"

module ATDIS
  class Location < Model
    attr_accessor :address, :lot, :section, :dpsp_id, :geometry

    field_mappings :address => :address,
      :land_title_ref => {
        :lot => :lot,
        :section => :section,
        :dpsp_id => :dpsp_id
      },
      :geometry => :geometry

    def geometry=(v)
      @geometry = Location.cast(v, RGeo::GeoJSON)
    end
  end
end
<commit_msg>Add autocasting to Location<commit_after>require "rgeo/geo_json"

module ATDIS
  class Location < Model
    field_mappings :address => :address,
      :land_title_ref => {
        :lot => :lot,
        :section => :section,
        :dpsp_id => :dpsp_id
      },
      :geometry => :geometry

    casting_attributes :address => String,
      :lot => String,
      :section => String,
      :dpsp_id => String,
      :geometry => RGeo::GeoJSON
  end
end

{'fraction_non_alphanumeric': 0.12782805429864252, 'fraction_numerical': 0.0, 'mean_word_length': 2.582995951417004, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2319318', 'n_tokens_mistral': 303, 'n_tokens_neox': 298, 'n_words': 68}