<commit_before>module KiwiCRM class EntityRels < Array

  def initialize object
    super Rels.select { |rel| rel.refs? object }
    @rels = Hash[map { |rel| rel.rel_of object }.group_by(&:first).map { |rel, rel_ofs| [rel, rel_ofs.map(&:last)] }]
  end

  def method_missing method, *args, &block
    @rels[method] or super
  end

end end<commit_msg>refactor EntityRels#initialize using Rel#rel_to_other and Rel#other_ref<commit_after>module KiwiCRM class EntityRels < Array

  def initialize object
    super Rels.select { |rel| rel.refs? object }
    @rels = group_by { |rel| rel.rel_to_other object }.each_value { |rels| rels.map! { |rel| rel.other_ref object } }
  end

  def method_missing method, *args, &block
    @rels[method] or super
  end

end end
{'fraction_non_alphanumeric': 0.11345646437994723, 'fraction_numerical': 0.0, 'mean_word_length': 4.093959731543624, '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': '4522863', 'n_tokens_mistral': 274, 'n_tokens_neox': 262, 'n_words': 75}