<commit_before>module Roarify
  class ProductUpdate < Product
    def initialize(product)
      @product = product
      update
    end

    def representer
      ProductDecorator.new(product_data)
    end

    def update
      if @product.changeable?
        raise 'Taken Handle'
      else
        binding.pry
        representer.put(representer.resource_request(@product.id))
      end
    end

    def product_data
      if @product.exists?
        @product.variants = merge_variants
      end
      @product
    end

    def merge_variants
      ## hang onto this for now
      safe_variants.any? ? @product.variants.select { |v| !v.nil? and v.option1 } : nil
    end

    def safe_variants
      has_variants? ? @product.variants.select { |v| !v.nil? and v.option1 } : []<commit_msg>removed pry<commit_after>module Roarify
  class ProductUpdate < Product
    def initialize(product)
      @product = product
      update
    end

    def representer
      ProductDecorator.new(product_data)
    end

    def update
      if @product.changeable?
        raise 'Taken Handle'
      else
        representer.put(representer.resource_request(@product.id))
      end
    end

    def product_data
      if @product.exists?
        @product.variants = merge_variants
      end
      @product
    end

    def merge_variants
      ## hang onto this for now
      safe_variants.any? ? @product.variants.select { |v| !v.nil? and v.option1 } : nil
    end

    def safe_variants
      has_variants? ? @product.variants.select { |v| !v.nil? and v.option1 } : []
{'fraction_non_alphanumeric': 0.08290488431876607, 'fraction_numerical': 0.002570694087403599, 'mean_word_length': 2.2573221757322175, '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': '5190630', 'n_tokens_mistral': 489, 'n_tokens_neox': 477, 'n_words': 118}