<commit_before>require 'active_model/serializer'

module Spree
  module Wombat
    class ImageSerializer < ActiveModel::Serializer
      attributes :url, :position, :title, :type, :dimensions

      def url
        add_host_prefix(object.attachment.url(:original)).gsub(/\?.*/, '')
      end

      def title
        object.alt
      end

      def type
        "original"
      end

      def dimensions
        {
          height: object.attachment_height,
          width: object.attachment_width
        }
      end

      private

      def add_host_prefix(url)
        return url unless ActionController::Base.asset_host
        dynamic_asset_host = ActionController::Base.asset_host =~ /\%d/ ? ActionController::Base.asset_host % rand(4) : ActionController::Base.asset_host
        protocol = ActionController::Base.asset_host =~ /\A\/\// ? 'https' : ''
        URI.join(protocol, dynamic_asset_host, url).to_s
      end

    end
  end
end<commit_msg>mising a column character<commit_after>require 'active_model/serializer'

module Spree
  module Wombat
    class ImageSerializer < ActiveModel::Serializer
      attributes :url, :position, :title, :type, :dimensions

      def url
        add_host_prefix(object.attachment.url(:original)).gsub(/\?.*/, '')
      end

      def title
        object.alt
      end

      def type
        "original"
      end

      def dimensions
        {
          height: object.attachment_height,
          width: object.attachment_width
        }
      end

      private

      def add_host_prefix(url)
        return url unless ActionController::Base.asset_host
        dynamic_asset_host = ActionController::Base.asset_host =~ /\%d/ ? ActionController::Base.asset_host % rand(4) : ActionController::Base.asset_host
        protocol = ActionController::Base.asset_host =~ /\A\/\// ? 'https:' : ''
        URI.join(protocol, dynamic_asset_host, url).to_s
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.10212545360290305, 'fraction_numerical': 0.0010368066355624676, 'mean_word_length': 2.3859649122807016, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7242034', 'n_tokens_mistral': 561, 'n_tokens_neox': 544, 'n_words': 118}