<commit_before>module Gon
  module Sinatra
    module Helpers
      def self.included base
        base.send(:include, InstanceMethods)
      end

      module InstanceMethods
        def include_gon(options = {})
          if Gon::Sinatra.request_env && Gon::Sinatra.all_variables.present?
            data = Gon::Sinatra.all_variables
            namespace = options[:namespace] || 'gon'
            script = "<script>window." + namespace + " = {};"
            unless options[:camel_case]
              data.each do |key, val|
                script += namespace + "." + key.to_s + '=' + val.to_json + ";"
              end
            else
              data.each do |key, val|
                script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_json + ";"
              end
            end
            script += "</script>"
            script.html_safe
          else
            ""
          end
        end
      end
    end

    module GonHelpers
      def self.included base
        base.send(:include, InstanceMethods)
      end

      module InstanceMethods
        def gon
          if !Gon::Sinatra.request_env || Gon::Sinatra.request != request.object_id
            Gon::Sinatra.request = request.object_id
            Gon::Sinatra.request_env = request.env
          end
          Gon
        end
      end
    end
  end
end

Sinatra::Helpers.send :include, Gon::Sinatra::Helpers
Sinatra::Base.send :include, Gon::Sinatra::GonHelpers
<commit_msg>Again - fix namespace<commit_after>module Gon
  module Sinatra
    module Helpers
      def self.included base
        base.send(:include, InstanceMethods)
      end

      module InstanceMethods
        def include_gon(options = {})
          if Gon::Sinatra.request_env && Gon::Sinatra.all_variables.present?
            data = Gon::Sinatra.all_variables
            namespace = options[:namespace] || 'gon'
            script = "<script>window." + namespace + " = {};"
            unless options[:camel_case]
              data.each do |key, val|
                script += namespace + "." + key.to_s + '=' + val.to_json + ";"
              end
            else
              data.each do |key, val|
                script += namespace + "." + key.to_s.camelize(:lower) + '=' + val.to_json + ";"
              end
            end
            script += "</script>"
            script.html_safe
          else
            ""
          end
        end
      end
    end

    module GonHelpers
      def self.included base
        base.send(:include, InstanceMethods)
      end

      module InstanceMethods
        def gon
          if !Gon::Sinatra.request_env || Gon::Sinatra.request != request.object_id
            Gon::Sinatra.request = request.object_id
            Gon::Sinatra.request_env = request.env
          end
          Gon::Sinatra
        end
      end
    end
  end
end

Sinatra::Helpers.send :include, Gon::Sinatra::Helpers
Sinatra::Base.send :include, Gon::Sinatra::GonHelpers

{'fraction_non_alphanumeric': 0.1065546218487395, 'fraction_numerical': 0.0, 'mean_word_length': 1.6690582959641256, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5494276', 'n_tokens_mistral': 845, 'n_tokens_neox': 840, 'n_words': 182}