<commit_before>module Spinach
  module Generators
    # A feature generator generates and/or writes an example feature steps class
    # given the parsed feture data
    class FeatureGenerator

      attr_reader :feature

      # @param [Feature] feature
      #   The feature returned from the {Parser}
      def initialize(feature)
        @feature = feature
      end

      # @return [Array<Hash>]
      #   an array of unique steps found in this feature, avoiding name
      #   repetition
      def steps
        scenario_steps   = @feature.scenarios.map(&:steps).flatten
        background_steps = @feature.background_steps

        (scenario_steps + background_steps).uniq(&:name)
      end

      # @return [String]
      #   this feature's name
      def name
        @feature.name
      end

      # @return [String]
      #   an example feature steps definition
      def generate
        result = StringIO.new
        result.puts "class #{Spinach::Support.camelize name} < Spinach::FeatureSteps"
        result.puts "  feature \'#{Spinach::Support.escape_single_commas name}\'\n"
        generated_steps = steps.map do |step|<commit_msg>Don't output the explicit 'feature' on the generator<commit_after>module Spinach
  module Generators
    # A feature generator generates and/or writes an example feature steps class
    # given the parsed feture data
    class FeatureGenerator

      attr_reader :feature

      # @param [Feature] feature
      #   The feature returned from the {Parser}
      def initialize(feature)
        @feature = feature
      end

      # @return [Array<Hash>]
      #   an array of unique steps found in this feature, avoiding name
      #   repetition
      def steps
        scenario_steps   = @feature.scenarios.map(&:steps).flatten
        background_steps = @feature.background_steps

        (scenario_steps + background_steps).uniq(&:name)
      end

      # @return [String]
      #   this feature's name
      def name
        @feature.name
      end

      # @return [String]
      #   an example feature steps definition
      def generate
        result = StringIO.new
        result.puts "class #{Spinach::Support.camelize name} < Spinach::FeatureSteps"
        generated_steps = steps.map do |step|
{'fraction_non_alphanumeric': 0.07671840354767184, 'fraction_numerical': 0.0, 'mean_word_length': 2.4233687405159334, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5820643', 'n_tokens_mistral': 619, 'n_tokens_neox': 595, 'n_words': 190}