<commit_before>require 'app/models/pod_version'

require 'peiji_san'

module Pod
  module TrunkApp
    class Pod < Sequel::Model
      self.dataset = :pods

      extend PeijiSan
      plugin :after_initialize
      plugin :timestamps
      plugin :validation_helpers

      one_to_many :versions, :class => 'Pod::TrunkApp::PodVersion'
      many_to_many :owners

      alias_method :deleted?, :deleted

      # Finds a pod by name that has *not* been deleted.
      #
      def self.find_by_name(name, include_deleted: false)
        if include_deleted
          find(:name => name)
        else
          find(:deleted => false, :name => name)
        end
      end

      # Finds a pod by name that has *not* been deleted.
      #
      # If the pod has owners but the specified user is not one of the owners the 'no access
      # allowed' block will be called.
      #
      def self.find_by_name_and_owner(name, owner, include_deleted: false)
        if pod = find_by_name(name, :include_deleted => include_deleted)
          if pod.owners.include?(owner)<commit_msg>[Docs] Update Pod.find_by_name for include_deleted param<commit_after>require 'app/models/pod_version'

require 'peiji_san'

module Pod
  module TrunkApp
    class Pod < Sequel::Model
      self.dataset = :pods

      extend PeijiSan
      plugin :after_initialize
      plugin :timestamps
      plugin :validation_helpers

      one_to_many :versions, :class => 'Pod::TrunkApp::PodVersion'
      many_to_many :owners

      alias_method :deleted?, :deleted

      # Finds a pod by name, only including deleted pods if `include_deleted` is
      # true.
      #
      def self.find_by_name(name, include_deleted: false)
        if include_deleted
          find(:name => name)
        else
          find(:deleted => false, :name => name)
        end
      end

      # Finds a pod by name that has *not* been deleted.
      #
      # If the pod has owners but the specified user is not one of the owners the 'no access
      # allowed' block will be called.
      #
      def self.find_by_name_and_owner(name, owner, include_deleted: false)
        if pod = find_by_name(name, :include_deleted => include_deleted)
          if pod.owners.include?(owner)
{'fraction_non_alphanumeric': 0.08037718904355635, 'fraction_numerical': 0.0, 'mean_word_length': 2.530903328050713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '6370662', 'n_tokens_mistral': 661, 'n_tokens_neox': 669, 'n_words': 207}