<commit_before>module Neo4j
  module Wrapper
    module Rule
      class EventListener
        class << self
          # ----------------------------------------------------------------------------------------------------------------
          # Event handling methods
          # ----------------------------------------------------------------------------------------------------------------

          def on_relationship_created(rel, *)
            Rule.trigger_rules(rel._start_node) if Rule.trigger?(rel._start_node)
            Rule.trigger_rules(rel._end_node) if Rule.trigger?(rel._end_node)
          end

          def on_property_changed(node, *changes)
            Rule.trigger_rules(node, *changes) if Rule.trigger?(node)
          end

          def on_node_deleted(node, old_properties, deleted_relationship_set, deleted_identity_map)
            # have we deleted a rule node ?
            del_rule_node = Rule.find_rule_node(node)
            del_rule_node && del_rule_node.clear_rule_node
            return if del_rule_node

            # do we have prop_aggregations for this
            clazz = old_properties['_classname']
            rule_node = Rule.rule_node_for(clazz)
            return if rule_node.nil?

            id = node.neo_id
            rule_node.rules.each do |rule|
              next if rule.functions.nil? || rule.bulk_update?
              rule_name = rule.rule_name.to_s<commit_msg>Fix for andreasronge/neo4j#178<commit_after>module Neo4j
  module Wrapper
    module Rule
      class EventListener
        class << self
          # ----------------------------------------------------------------------------------------------------------------
          # Event handling methods
          # ----------------------------------------------------------------------------------------------------------------

          def on_relationship_created(rel, *)
            Rule.trigger_rules(rel._start_node) if Rule.trigger?(rel._start_node)
            Rule.trigger_rules(rel._end_node) if Rule.trigger?(rel._end_node)
          end

          def on_property_changed(node, *changes)
            Rule.trigger_rules(node, *changes) if Rule.trigger?(node)
          end

          def on_node_deleted(node, old_properties, deleted_relationship_set, deleted_identity_map)
            # have we deleted a rule node ?
            del_rule_node = Rule.find_rule_node(node)
            del_rule_node && del_rule_node.clear_rule_node
            return if del_rule_node

            # do we have prop_aggregations for this
            clazz = old_properties['_classname']
            rule_node = Rule.rule_node_for(clazz)
            return if rule_node.nil?

            id = node.neo_id
            rule_node.rules.each do |rule|
              next if rule.functions.nil? || (rule_node.rules.size == 1 && rule.bulk_update?)
              rule_name = rule.rule_name.to_s
{'fraction_non_alphanumeric': 0.21655172413793103, 'fraction_numerical': 0.002413793103448276, 'mean_word_length': 1.3097133757961783, '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': '6331971', 'n_tokens_mistral': 719, 'n_tokens_neox': 705, 'n_words': 147}