<commit_before>require 'active_support/concern'

module Caprese
  module Versioning
    extend ActiveSupport::Concern

    # Get full namespaced module name of object (class)
    #
    # @example
    #   namespaced_module('OrdersController') => 'API::V1::OrdersController'
    #
    # @param [String] suffix the string to append, hypothetically a module in
    #  this version's module space
    # @return [String] the namespaced modulized name of the suffix passed in
    def namespaced_module(suffix = nil)
      name = (self.is_a?(Class) ? self : self.class).name.deconstantize

      name + (suffix ? "::#{suffix}" : '')
    end

    # Get versioned module name of object (class)
    # @note The difference between namespaced and versioned module names is that if an isolated_namespace
    #   is present, version_module will return a module name without the isolated namespace
    #
    # @example
    #   version_module('OrdersController') => 'API::V1::OrdersController'
    #
    # @param [String] suffix the string to append, hypothetically a module in
    #  this version's module space
    # @return [String] the versioned modulized name of the suffix passed in
    def version_module(suffix = nil)
      name = namespaced_module(suffix)

      name = name.gsub("#{Caprese.config.isolated_namespace}::", '') if Caprese.config.isolated_namespace

      name
    end

    # Get versioned path (url)
    #
    # @example
    #   version_path('orders') => 'api/v1/orders'
    #<commit_msg>Only prepend in namespaced_module if not already prepended<commit_after>require 'active_support/concern'

module Caprese
  module Versioning
    extend ActiveSupport::Concern

    # Get full namespaced module name of object (class)
    #
    # @example
    #   namespaced_module('OrdersController') => 'API::V1::OrdersController'
    #
    # @param [String] suffix the string to append, hypothetically a module in
    #  this version's module space
    # @return [String] the namespaced modulized name of the suffix passed in
    def namespaced_module(suffix = nil)
      name = (self.is_a?(Class) ? self : self.class).name.deconstantize

      name = suffix.prepend("#{name}::") unless (/^#{name}\.*/).match(suffix)

      name + (suffix ? "::#{suffix}" : '')
    end

    # Get versioned module name of object (class)
    # @note The difference between namespaced and versioned module names is that if an isolated_namespace
    #   is present, version_module will return a module name without the isolated namespace
    #
    # @example
    #   version_module('OrdersController') => 'API::V1::OrdersController'
    #
    # @param [String] suffix the string to append, hypothetically a module in
    #  this version's module space
    # @return [String] the versioned modulized name of the suffix passed in
    def version_module(suffix = nil)
      name = namespaced_module(suffix)

      name = name.gsub("#{Caprese.config.isolated_namespace}::", '') if Caprese.config.isolated_namespace

      name
    end

    # Get versioned path (url)
    #
    # @example
    #   version_path('orders') => 'api/v1/orders'
    #
{'fraction_non_alphanumeric': 0.10115606936416185, 'fraction_numerical': 0.0019267822736030828, 'mean_word_length': 3.338440111420613, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, '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': '3084815', 'n_tokens_mistral': 949, 'n_tokens_neox': 890, 'n_words': 283}