<commit_before># Extend object with the dependency injection mechanism
# Example of usage:
# class Bar
# end
#
# class Foo
#   inject :bar
# end
#
# ioc_container[:foo].bar == ioc_container[:bar]
class Object

  class << self

    def inject(*dependency_names)
      unless dependency_names.all?{|name| name.is_a?(Symbol) }
        raise ArgumentError, "inject accepts only symbols"
      end
      if class_variable_defined?(:@@injectable_attrs)
        injectable_attrs = class_variable_get(:@@injectable_attrs)
        injectable_attrs |= dependency_names
      else
        class_variable_set(:@@injectable_attrs, dependency_names)
      end
      attr_accessor *dependency_names
    end

  end

end<commit_msg>Allow to call inject multiple times<commit_after># Extend object with the dependency injection mechanism
# Example of usage:
# class Bar
# end
#
# class Foo
#   inject :bar
# end
#
# ioc_container[:foo].bar == ioc_container[:bar]
class Object

  class << self

    def inject(*dependency_names)
      unless dependency_names.all?{|name| name.is_a?(Symbol) }
        raise ArgumentError, "inject accepts only symbols"
      end
      if class_variable_defined?(:@@injectable_attrs)
        injectable_attrs = class_variable_get(:@@injectable_attrs)
        injectable_attrs |= dependency_names
        class_variable_set(:@@injectable_attrs, injectable_attrs)
      else
        class_variable_set(:@@injectable_attrs, dependency_names)
      end
      attr_accessor *dependency_names
    end

  end

end
{'fraction_non_alphanumeric': 0.08695652173913043, 'fraction_numerical': 0.0, 'mean_word_length': 3.6882716049382718, 'pattern_counts': {'":': 0, '<': 7, '<?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': '470616', 'n_tokens_mistral': 451, 'n_tokens_neox': 438, 'n_words': 110}