<commit_before>module ActionView #:nodoc:
  class Base
    cattr_accessor :pretty_print_json
    @@pretty_print_json = true
    
    cattr_accessor :json_callback
    @@json_callback = true
  end
end

# Rails 2.X Template
if defined?(Rails) && Rails.version =~ /^2/
  require 'action_view/base'
  require 'action_view/template'

  module ActionView
    module TemplateHandlers
      class JSONBuilder < TemplateHandler
        include Compilable

        def compile(template)
          "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{template.source}};"
        end
      end
    end
  end

  ActionView::Template.register_template_handler :json_builder, ActionView::TemplateHandlers::JSONBuilder
end

# Rails 3.X Template
if defined?(Rails) && Rails.version =~ /^3/
  module ActionView
    module Template::Handlers
      class JSONBuilder
        class_attribute :default_format
        self.default_format = Mime::JSON

        def self.call(template)
          source = if template.source.empty?
            File.read(template.identifier)
          else # use source
            template.source
          end

          "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{source}};"
        end
      end
    end
  end

  ActionView::Template.register_template_handler :json_builder, ActionView::Template::Handlers::JSONBuilder
end
<commit_msg>Default pretty print environment<commit_after>module ActionView #:nodoc:
  class Base
    cattr_accessor :pretty_print_json
    @@pretty_print_json = defined?(Rails) && Rails.env.development?
    
    cattr_accessor :json_callback
    @@json_callback = true
  end
end

# Rails 2.X Template
if defined?(Rails) && Rails.version =~ /^2/
  require 'action_view/base'
  require 'action_view/template'

  module ActionView
    module TemplateHandlers
      class JSONBuilder < TemplateHandler
        include Compilable

        def compile(template)
          "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{template.source}};"
        end
      end
    end
  end

  ActionView::Template.register_template_handler :json_builder, ActionView::TemplateHandlers::JSONBuilder
end

# Rails 3.X Template
if defined?(Rails) && Rails.version =~ /^3/
  module ActionView
    module Template::Handlers
      class JSONBuilder
        class_attribute :default_format
        self.default_format = Mime::JSON

        def self.call(template)
          source = if template.source.empty?
            File.read(template.identifier)
          else # use source
            template.source
          end

          "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{source}};"
        end
      end
    end
  end

  ActionView::Template.register_template_handler :json_builder, ActionView::Template::Handlers::JSONBuilder
end

{'fraction_non_alphanumeric': 0.10082961072112316, 'fraction_numerical': 0.0025526483726866626, 'mean_word_length': 3.3301104972375692, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 15, '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': '2106785', 'n_tokens_mistral': 915, 'n_tokens_neox': 877, 'n_words': 194}