<commit_before>require 'rubygems'
require 'sk_sdk'
require 'active_resource'
require 'active_resource/version'
# patches are for specific AR version
case ActiveResource::VERSION::MAJOR
when 3
  require 'sk_sdk/ar_patches/ar3/base'
  require 'sk_sdk/ar_patches/ar3/validations'
when 4,5
  require 'sk_sdk/ar_patches/ar4/validations'
  require 'sk_sdk/ar_patches/ar4/base'
end

class SK::SDK::Base < ActiveResource::Base
  self.format = :json
  # hook before init in activeresource base because json comes in nested:
  # {client={data}
  if (ActiveResource::VERSION::MAJOR == 3 && ActiveResource::VERSION::MINOR > 0) || ActiveResource::VERSION::MAJOR > 3
    self.include_root_in_json = true
    def initialize(attributes = {}, *args)
      attr = attributes[self.class.element_name] || attributes
      super(attr, *args)
    end<commit_msg>add patches for activeresource 6<commit_after>require 'rubygems'
require 'sk_sdk'
require 'active_resource'
require 'active_resource/version'
# patches are for specific AR version
case ActiveResource::VERSION::MAJOR
when 3
  require 'sk_sdk/ar_patches/ar3/base'
  require 'sk_sdk/ar_patches/ar3/validations'
when 4,5,6
  require 'sk_sdk/ar_patches/ar4/validations'
  require 'sk_sdk/ar_patches/ar4/base'
end

class SK::SDK::Base < ActiveResource::Base
  self.format = :json
  # hook before init in activeresource base because json comes in nested:
  # {client={data}
  if ActiveResource::VERSION::MAJOR == 6
    self.include_root_in_json = true
    def initialize(attributes = {}, persisted=false)
      attr = attributes[self.class.element_name] || attributes
      super(attr, persisted)
    end
  elsif (ActiveResource::VERSION::MAJOR == 3 && ActiveResource::VERSION::MINOR > 0) || ActiveResource::VERSION::MAJOR < 6
    self.include_root_in_json = true
    def initialize(attributes = {}, *args)
      attr = attributes[self.class.element_name] || attributes
      super(attr, *args)
    end
{'fraction_non_alphanumeric': 0.11369509043927649, 'fraction_numerical': 0.011886304909560724, 'mean_word_length': 4.938650306748467, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '187881', 'n_tokens_mistral': 640, 'n_tokens_neox': 617, 'n_words': 145}