<commit_before>module ActiveScaffold::DataStructures
  class ActionLinks
    include Enumerable

    def initialize
      @set = []
    end

    # adds an ActionLink, creating one from the arguments if need be
    def add(action, options = {})
      link = action.is_a?(ActiveScaffold::DataStructures::ActionLink) ? action : ActiveScaffold::DataStructures::ActionLink.new(action, options)
      # NOTE: this duplicate check should be done by defining the comparison operator for an Action data structure
      @set << link unless @set.any? {|a| a.action == link.action and a.controller == link.controller and a.parameters == link.parameters}
    end
    alias_method :<<, :add<commit_msg>always return an action_link<commit_after>module ActiveScaffold::DataStructures
  class ActionLinks
    include Enumerable

    def initialize
      @set = []
    end

    # adds an ActionLink, creating one from the arguments if need be
    def add(action, options = {})
      link = action.is_a?(ActiveScaffold::DataStructures::ActionLink) ? action : ActiveScaffold::DataStructures::ActionLink.new(action, options)
      # NOTE: this duplicate check should be done by defining the comparison operator for an Action data structure
      existing = @set.find {|a| a.action == link.action and a.controller == link.controller and a.parameters == link.parameters}
      unless existing
        @set << link
        link
      else
        existing
      end
    end
    alias_method :<<, :add
{'fraction_non_alphanumeric': 0.08807588075880758, 'fraction_numerical': 0.0, 'mean_word_length': 3.4354354354354353, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2489719', 'n_tokens_mistral': 396, 'n_tokens_neox': 393, 'n_words': 132}