<commit_before>require 'pp'

module Awspec::Generator
  module Doc
    class Base
      def generate_doc
        @matchers += collect_matchers - @ignore_matchers
        @matchers.sort! do |a, b|
          sort_num(a) <=> sort_num(b)
        end
        @describes += @ret.members.select do |describe|
          next true unless @ret[describe].is_a?(Array) || @ret[describe].is_a?(Hash)
        end if @ret.respond_to?(:members)
        its = @describes.map do |describe|
          'its(:' + describe.to_s + ')'
        end

        @descriptions = {}
        merge_file = File.dirname(__FILE__) + '/../../../../doc/_resource_types/' + @type_name.to_snake_case + '.md'
        if File.exist?(merge_file)
          matcher = nil
          File.foreach(merge_file) do |line|
            if /\A### (.+)\Z/ =~ line
              matcher = Regexp.last_match[1]
              next
            end
            @descriptions[matcher] = '' unless @descriptions[matcher]
            @descriptions[matcher] += line
          end
        end
        ERB.new(doc_template, nil, '-').result(binding)
      end

      def collect_matchers
        methods = @type.methods - Awspec::Helper::Finder.instance_methods - Object.methods
        methods.select! do |method|
          method.to_s.include?('?')<commit_msg>tiny fix<commit_after>require 'pp'

module Awspec::Generator
  module Doc
    class Base
      def generate_doc
        @matchers += collect_matchers - @ignore_matchers
        @matchers.sort! do |a, b|
          sort_num(a) <=> sort_num(b)
        end
        @describes += @ret.members.select do |describe|
          next true unless @ret[describe].is_a?(Array) || @ret[describe].is_a?(Hash) || @ret[describe].is_a?(Struct)
        end if @ret.respond_to?(:members)
        its = @describes.map do |describe|
          'its(:' + describe.to_s + ')'
        end

        @descriptions = {}
        merge_file = File.dirname(__FILE__) + '/../../../../doc/_resource_types/' + @type_name.to_snake_case + '.md'
        if File.exist?(merge_file)
          matcher = nil
          File.foreach(merge_file) do |line|
            if /\A### (.+)\Z/ =~ line
              matcher = Regexp.last_match[1]
              next
            end
            @descriptions[matcher] = '' unless @descriptions[matcher]
            @descriptions[matcher] += line
          end
        end
        ERB.new(doc_template, nil, '-').result(binding)
      end

      def collect_matchers
        methods = @type.methods - Awspec::Helper::Finder.instance_methods - Object.methods
        methods.select! do |method|
          method.to_s.include?('?')
{'fraction_non_alphanumeric': 0.1391536408692337, 'fraction_numerical': 0.0007624857033930614, 'mean_word_length': 1.9988571428571429, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3200523', 'n_tokens_mistral': 821, 'n_tokens_neox': 812, 'n_words': 163}