<commit_before>module SystemTester
  class Step < ApplicationRecord
    # include TitleValidatable
    validates_presence_of :title
    validates_uniqueness_of :title, scope: [:type, :arg_one, :arg_two]

    INDENT = " " * 6
    has_many :scenario_steps,
             class_name: "SystemTester::ScenarioStep",
             foreign_key: "system_tester_step_id",
             dependent: :destroy
    has_many :scenarios, through: :scenario_steps

    has_many :stair_steps,
             class_name: "SystemTester::StairStep",
             foreign_key: "system_tester_step_id",
             dependent: :destroy
    has_many :stairs, through: :stair_steps

    after_commit do
      stairs.each do |stair|
        stair.touch
      end
      scenarios.each do |scenario|
        scenario.feature.touch if scenario.feature.present?
      end
    end

    def self.friendly_type
      name.demodulize
    end

    def self.parent_type
      ancestors.fourth.name ? ancestors.fourth.name.demodulize : "Step"
    end

    def self.bg_css
      "teal"
    end

    def self.text_css
      "white-text"
    end

    def friendly_type
      self.class.friendly_type
    end

    def parent_type
      self.class.parent_type
    end

    def bg_css
      self.class.bg_css
    end

    def text_css
      self.class.text_css
    end

    def module
      ""
    end

    def self.args
      [
        {
          name: 'arg_one',
          label: 'One',
          type: 'text'
        },
        {
          name: 'arg_two',
          label: 'Two',
          type: 'text'
        }
      ]
    end

    def self.leafs
      (descendants - direct_descendants).map do |desc|
        {
          name: desc.to_s,
          friendly: desc.friendly_type,
          parent: desc.parent_type,
          args: desc.args
        }
      end.sort_by { |step_type| [step_type[:parent_type], step_type[:friendly]] }
    end

    def self.parent_types
      direct_descendants.map do |desc|
        {
          name: desc.to_s,
          friendly: desc.friendly_type
        }
      end.sort_by { |step_type| step_type[:friendly] }
    end

    def commented_title
      title.split("\n").map { |line| "# #{line}" }.join("\n").shift(2)
    end
  end
end<commit_msg>there isnt a shift method<commit_after>module SystemTester
  class Step < ApplicationRecord
    # include TitleValidatable
    validates_presence_of :title
    validates_uniqueness_of :title, scope: [:type, :arg_one, :arg_two]

    INDENT = " " * 6
    has_many :scenario_steps,
             class_name: "SystemTester::ScenarioStep",
             foreign_key: "system_tester_step_id",
             dependent: :destroy
    has_many :scenarios, through: :scenario_steps

    has_many :stair_steps,
             class_name: "SystemTester::StairStep",
             foreign_key: "system_tester_step_id",
             dependent: :destroy
    has_many :stairs, through: :stair_steps

    after_commit do
      stairs.each do |stair|
        stair.touch
      end
      scenarios.each do |scenario|
        scenario.feature.touch if scenario.feature.present?
      end
    end

    def self.friendly_type
      name.demodulize
    end

    def self.parent_type
      ancestors.fourth.name ? ancestors.fourth.name.demodulize : "Step"
    end

    def self.bg_css
      "teal"
    end

    def self.text_css
      "white-text"
    end

    def friendly_type
      self.class.friendly_type
    end

    def parent_type
      self.class.parent_type
    end

    def bg_css
      self.class.bg_css
    end

    def text_css
      self.class.text_css
    end

    def module
      ""
    end

    def self.args
      [
        {
          name: 'arg_one',
          label: 'One',
          type: 'text'
        },
        {
          name: 'arg_two',
          label: 'Two',
          type: 'text'
        }
      ]
    end

    def self.leafs
      (descendants - direct_descendants).map do |desc|
        {
          name: desc.to_s,
          friendly: desc.friendly_type,
          parent: desc.parent_type,
          args: desc.args
        }
      end.sort_by { |step_type| [step_type[:parent_type], step_type[:friendly]] }
    end

    def self.parent_types
      direct_descendants.map do |desc|
        {
          name: desc.to_s,
          friendly: desc.friendly_type
        }
      end.sort_by { |step_type| step_type[:friendly] }
    end

    def commented_title
      title.split("\n").map { |line| "# #{line}" }.join("\n")[2..-1]
    end
  end
end
{'fraction_non_alphanumeric': 0.09220489977728286, 'fraction_numerical': 0.0011135857461024498, 'mean_word_length': 1.8586887332908975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3691007', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1431, 'n_words': 301}