<commit_before>module YARD
  module CLI
    # A tool to view documentation in the console like `ri`
    class YRI < Base
      CACHE_FILE = File.expand_path('~/.yard/yri_cache')
      SEARCH_PATHS_FILE = File.expand_path('~/.yard/yri_search_paths')
      
      # Helper method to run the utility on an instance.
      # @see #run
      def self.run(*args) new.run(*args) end
        
      def initialize
        super
        @cache = {}
        @search_paths = []
        add_default_paths
        add_gem_paths
        load_cache
        @search_paths.uniq!
      end
        
      # Runs the command-line utility.
      # 
      # @example
      #   YRI.new.run('String#reverse')
      # @param [Array<String>] args each tokenized argument
      def run(*args)
        optparse(*args)
        
        @serializer ||= YARD::Serializers::ProcessSerializer.new('less')
        
        if @name.nil? || @name.strip.empty?
          print_usage
          exit(1)
        elsif object = find_object(@name)
          print_object(object)
        else<commit_msg>Don't use less on Windows (non-cygwin)<commit_after>require 'rbconfig'

module YARD
  module CLI
    # A tool to view documentation in the console like `ri`
    class YRI < Base
      CACHE_FILE = File.expand_path('~/.yard/yri_cache')
      SEARCH_PATHS_FILE = File.expand_path('~/.yard/yri_search_paths')
      
      # Helper method to run the utility on an instance.
      # @see #run
      def self.run(*args) new.run(*args) end
        
      def initialize
        super
        @cache = {}
        @search_paths = []
        add_default_paths
        add_gem_paths
        load_cache
        @search_paths.uniq!
      end
        
      # Runs the command-line utility.
      # 
      # @example
      #   YRI.new.run('String#reverse')
      # @param [Array<String>] args each tokenized argument
      def run(*args)
        optparse(*args)
        
        if Config::CONFIG['host_os'] =~ /mingw|win32/
          @serializer ||= YARD::Serializers::StdoutSerializer.new
        else
          @serializer ||= YARD::Serializers::ProcessSerializer.new('less')
        end
        
        if @name.nil? || @name.strip.empty?
          print_usage
          exit(1)
        elsif object = find_object(@name)
          print_object(object)
        else
{'fraction_non_alphanumeric': 0.10353753235547886, 'fraction_numerical': 0.001725625539257981, 'mean_word_length': 1.906015037593985, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3994558', 'n_tokens_mistral': 710, 'n_tokens_neox': 698, 'n_words': 159}