<commit_before>require "rspec/contracts/interaction"
require "rspec/contracts/interaction_group"

module RSpec
  module Contracts
    class Interface
      attr_reader :name

      def initialize(name)
        @name = name
      end

      def requirements
        Interface.requirements.select { |i| i.interface_name == name }
      end

      def implementations
        Interface.implementations.select { |i| i.interface_name == name }
      end

      def add_requirement(method_name, options = {})
        Interface.requirements.add Interaction.new(name, method_name, options)
      end

      def add_implementation(method_name, options = {})
        Interface.implementations.add Interaction.new(name, method_name, options)
      end

      def self.implementations
        @implementations ||= InteractionGroup.new
      end

      def self.requirements
        @requrements ||= InteractionGroup.new
      end

      def self.all
        @all ||= {}
      end

      def self.find_or_create(name)
        all[name] ||= new(name)<commit_msg>Simplify interaction group management within Interface<commit_after>require "rspec/contracts/interaction"
require "rspec/contracts/interaction_group"

module RSpec
  module Contracts
    class Interface
      attr_reader :name, :requirements, :implementations

      def initialize(name)
        @name = name
        @requirements = InteractionGroup.new
        @implementations = InteractionGroup.new
      end

      def add_requirement(method_name, options = {})
        @requirements.add Interaction.new(name, method_name, options)
      end

      def add_implementation(method_name, options = {})
        @implementations.add Interaction.new(name, method_name, options)
      end

      def self.all
        @all ||= {}
      end

      def self.find_or_create(name)
        all[name] ||= new(name)
{'fraction_non_alphanumeric': 0.08531317494600432, 'fraction_numerical': 0.0, 'mean_word_length': 2.706, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4801437', 'n_tokens_mistral': 535, 'n_tokens_neox': 510, 'n_words': 116}