<commit_before>class MomentSerializer < ActiveModel::Serializer

  attributes :id, :caption, :image, :formatted_timestamp, :source_url, :location,
             :description, :source_name, :license, :source_image_url,  :links

  def links
    controller = options[:controller]
    return {} if controller.blank?
    {
      :web     => controller.explore_moment_url(object),
      :self    => controller.moment_url(object, format: "json"),
      :geojson => controller.moment_url(object, format: "geojson"),
      :kml     => controller.moment_url(object, format: "kml")
    }
  end

  def image
    {
      full:    {url: object.image.url, width: object.width, height: object.height},
      primary: {url: object.image.url(:primary), width: 600, height: 300},
      thumb:   {url: object.image.url(:thumb), width: 300, height: 300}
    }
  end

  def location
    coords = object.coordinates
    {
      name: object.location,
      lat:  coords.lat,
      lng:  coords.lon
    }
  end

  private

end
<commit_msg>Ain't nobody got time for that...<commit_after>class MomentSerializer < ActiveModel::Serializer

  attributes :id, :caption, :image, :formatted_timestamp, :source_url, :location,
             :description, :source_name, :license, :source_image_url,  :links

  def links
    controller = options[:controller]
    return {} if controller.blank?
    {
      :web     => controller.explore_moment_url(object),
      :self    => controller.moment_url(object, format: "json"),
      :geojson => controller.moment_url(object, format: "geojson"),
      :kml     => controller.moment_url(object, format: "kml")
    }
  end

  def image
    {
      full:    {url: object.image.url, width: object.width, height: object.height},
      primary: {url: object.image.url(:primary), width: 600, height: 300},
      thumb:   {url: object.image.url(:thumb), width: 300, height: 300}
    }
  end

  def location
    coords = object.coordinates
    {
      name: object.location,
      lat:  coords.lat,
      lng:  coords.lon
    }
  end

end

{'fraction_non_alphanumeric': 0.12960235640648013, 'fraction_numerical': 0.011782032400589101, 'mean_word_length': 2.957281553398058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '506957', 'n_tokens_mistral': 672, 'n_tokens_neox': 635, 'n_words': 152}