<commit_before>module Pod
  class Command
    class Presenter
      def self.options
        "    --stats     Show additional stats (like GitHub watchers and forks)\n"
      end

      autoload :CocoaPod, 'cocoapods/command/presenter/cocoa_pod'

      def initialize(argv)
        @stats = argv.option('--stats')
      end

      def render(array)
        result = "\n"
        seats.each {|s| puts describe(s)}
        result
      end

      def describe(set)
        pod = CocoaPod.new(set)
        result = "\n--> #{pod.name} (#{pod.versions})\n".green
        result << wrap_string(pod.summary)
        result << detail('Homepage', pod.homepage)
        result << detail('Source',   pod.source_url)
        result << detail('Authors',  pod.authors)         if @stats && pod.authors =~ /,/
        result << detail('Author',   pod.authors)         if @stats && pod.authors !~ /,/
        result << detail('Platform', pod.platform)        if @stats
        result << detail('License',  pod.license)         if @stats
        result << detail('Watchers', pod.github_watchers) if @stats
        result << detail('Forks',    pod.github_forks)    if @stats
        result << detail('Sub specs', pod.subspecs)
        result
      end

      private

      # adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
      def wrap_string(txt, col = 80, indentation = 4)
        indent = ' ' * indentation
        txt.strip.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/, indent + "\\1\\3\n")
      end

      def detail(title, value, preferred_indentation = 8)
        # 8 is the length of Homepage
        return '' if !value
        number_of_spaces = ((preferred_indentation - title.length) > 0) ? (preferred_indentation - title.length) : 0<commit_msg>removed extra `if @stats` check in presenter<commit_after>module Pod
  class Command
    class Presenter
      def self.options
        "    --stats     Show additional stats (like GitHub watchers and forks)\n"
      end

      autoload :CocoaPod, 'cocoapods/command/presenter/cocoa_pod'

      def initialize(argv)
        @stats = argv.option('--stats')
      end

      def render(array)
        result = "\n"
        seats.each {|s| puts describe(s)}
        result
      end

      def describe(set)
        pod = CocoaPod.new(set)
        result = "\n--> #{pod.name} (#{pod.versions})\n".green
        result << wrap_string(pod.summary)
        result << detail('Homepage', pod.homepage)
        result << detail('Source',   pod.source_url)
        if @stats
          result << detail('Authors',  pod.authors) if pod.authors =~ /,/
          result << detail('Author',   pod.authors) if pod.authors !~ /,/
          result << detail('Platform', pod.platform)
          result << detail('License',  pod.license)
          result << detail('Watchers', pod.github_watchers)
          result << detail('Forks',    pod.github_forks)
        end
        result << detail('Sub specs', pod.subspecs)
        result
      end

      private

      # adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
      def wrap_string(txt, col = 80, indentation = 4)
        indent = ' ' * indentation
        txt.strip.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/, indent + "\\1\\3\n")
      end

      def detail(title, value, preferred_indentation = 8)
        # 8 is the length of Homepage
        return '' if !value
        number_of_spaces = ((preferred_indentation - title.length) > 0) ? (preferred_indentation - title.length) : 0
{'fraction_non_alphanumeric': 0.14103653355989804, 'fraction_numerical': 0.007929764939110734, 'mean_word_length': 2.181981981981982, 'pattern_counts': {'":': 0, '<': 43, '<?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': '1989336', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1062, 'n_words': 254}