<commit_before>
module ArIdeyabox
  # In model just add this line
  # has_not_this :person, through: :professions_people, order: :title, by: :title, group_by: {play: :title}
  # :order and :by - optionally
  # :group_by is for group selectors, if you want grouping roles by play titles, just add group_by: {play: :title}
  
  def first_el_tryer(object, by)
    if by.class == Hash
      object.try(by.keys[0]).try(by.values[0])
    else
      object.try(by)
    end
  end

  def has_not_this(model_name, *args)<commit_msg>added visible and by position scopes<commit_after>module ArIdeyabox
  # In model just add this line
  # has_not_this :person, through: :professions_people, order: :title, by: :title, group_by: {play: :title}
  # :order and :by - optionally
  # :group_by is for group selectors, if you want grouping roles by play titles, just add group_by: {play: :title}
  
  def visible
    where(visible: true)
  end

  def by_position
    order(:position)
  end

  def visible_by_position
    visible.by_position
  end

  def first_el_tryer(object, by)
    if by.class == Hash
      object.try(by.keys[0]).try(by.values[0])
    else
      object.try(by)
    end
  end

  def has_not_this(model_name, *args)
{'fraction_non_alphanumeric': 0.102880658436214, 'fraction_numerical': 0.0032921810699588477, 'mean_word_length': 3.5714285714285716, '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': '6299432', 'n_tokens_mistral': 433, 'n_tokens_neox': 422, 'n_words': 128}