<commit_before>module Myob
  module Api

    module RefinedString
      refine String do
        def underscore
          self.gsub(/::/, '/').
          gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
          gsub(/([a-z\d])([A-Z])/,'\1_\2').
          tr("-", "_").
          downcase
        end
      end
    end

    module Helpers
      using RefinedString

      def model(model_name)
        method_name = model_name.to_s.underscore
        variable_name = "@#{method_name}_model".to_sym
        unless instance_variable_defined?(variable_name)
          instance_variable_set(variable_name, Myob::Api::Model.const_get("#{model_name}".to_sym).new(self, model_name.to_s))
          self.define_singleton_method(method_name.to_sym) do
            instance_variable_get(variable_name)
          end
        end
        instance_variable_get(variable_name)
      end
    end

  end
end<commit_msg>Removed refinement from helper<commit_after>module Myob
  module Api
    module Helpers

      def model(model_name)
        method_name = model_name.to_s.gsub(/::/, '/').
          gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
          gsub(/([a-z\d])([A-Z])/,'\1_\2').
          tr("-", "_").
          downcase
        variable_name = "@#{method_name}_model".to_sym
        unless instance_variable_defined?(variable_name)
          instance_variable_set(variable_name, Myob::Api::Model.const_get("#{model_name}".to_sym).new(self, model_name.to_s))
          self.define_singleton_method(method_name.to_sym) do
            instance_variable_get(variable_name)
          end
        end
        instance_variable_get(variable_name)
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.13774271844660194, 'fraction_numerical': 0.0048543689320388345, 'mean_word_length': 2.3112449799196786, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3707380', 'n_tokens_mistral': 547, 'n_tokens_neox': 552, 'n_words': 77}