<commit_before>module Merb
  module Assets
    
    # Check whether the assets should be bundled.
    #
    # ==== Returns
    # Boolean::
    #   True if the assets should be bundled (e.g., production mode or
    #   :bundle_assets is explicitly enabled).
    def self.bundle?
      (Merb.environment == 'production') ||
      (!!Merb::Config[:bundle_assets])
    end
    
    # Helpers for handling asset files.
    module AssetHelpers
      # :nodoc:
      ASSET_FILE_EXTENSIONS = {
        :javascript => ".js",
        :stylesheet => ".css"
      }
      
      # Returns the URI path to a particular asset file. If +local_path+ is
      # true, returns the path relative to the Merb.root, not the public
      # directory. Uses the path_prefix, if any is configured.
      # 
      # ==== Parameters
      # asset_type<Symbol>:: Type of the asset (e.g. :javascript).
      # filename<~to_s>:: The path to the file.
      # local_path<Boolean>::
      #   If true, the returned path will be relative to the Merb.root,
      #   otherwise it will be the public URI path. Defaults to false.
      #
      # ==== Returns
      # String:: The path to the asset.
      #
      # ==== Examples
      #   asset_path(:javascript, :dingo)
      #   # => "/javascripts/dingo.js"
      #
      #   asset_path(:javascript, :dingo, true)
      #   # => "public/javascripts/dingo.js"
      def asset_path(asset_type, filename, local_path = false)
        filename = filename.to_s
        if filename !~ /#{'\\' + ASSET_FILE_EXTENSIONS[asset_type]}\Z/
          filename << ASSET_FILE_EXTENSIONS[asset_type]
        end
        if filename !~ %r{^https?://}
          filename = "/#{asset_type}s/#{filename}"
        end
        if local_path
          return "public#{filename}"
        else
          return "#{Merb::Config[:path_prefix]}#{filename}"
        end
      end
    end
    
    # Helper for creating unique paths to a file name
    # Can increase speend for browsers that are limited to a certain number of connections per host 
    # for downloading static files (css, js, images...)
    class UniqueAssetPath
      class << self
        # Builds the path to the file based on the name
        # <commit_msg>Properly handle assets urls with query strings in them<commit_after>module Merb
  module Assets
    
    # Check whether the assets should be bundled.
    #
    # ==== Returns
    # Boolean::
    #   True if the assets should be bundled (e.g., production mode or
    #   :bundle_assets is explicitly enabled).
    def self.bundle?
      (Merb.environment == 'production') ||
      (!!Merb::Config[:bundle_assets])
    end
    
    # Helpers for handling asset files.
    module AssetHelpers
      # :nodoc:
      ASSET_FILE_EXTENSIONS = {
        :javascript => ".js",
        :stylesheet => ".css"
      }
      
      # Returns the URI path to a particular asset file. If +local_path+ is
      # true, returns the path relative to the Merb.root, not the public
      # directory. Uses the path_prefix, if any is configured.
      # 
      # ==== Parameters
      # asset_type<Symbol>:: Type of the asset (e.g. :javascript).
      # filename<~to_s>:: The path to the file.
      # local_path<Boolean>::
      #   If true, the returned path will be relative to the Merb.root,
      #   otherwise it will be the public URI path. Defaults to false.
      #
      # ==== Returns
      # String:: The path to the asset.
      #
      # ==== Examples
      #   asset_path(:javascript, :dingo)
      #   # => "/javascripts/dingo.js"
      #
      #   asset_path(:javascript, :dingo, true)
      #   # => "public/javascripts/dingo.js"
      def asset_path(asset_type, filename, local_path = false)
        filename = filename.to_s
        if filename !~ /#{'\\' + ASSET_FILE_EXTENSIONS[asset_type]}\Z/ && filename.index('?').nil?
          filename << ASSET_FILE_EXTENSIONS[asset_type]
        end
        if filename !~ %r{^https?://}
          filename = "/#{asset_type}s/#{filename}"
        end
        if local_path
          return "public#{filename}"
        else
          return "#{Merb::Config[:path_prefix]}#{filename}"
        end
      end
    end
    
    # Helper for creating unique paths to a file name
    # Can increase speend for browsers that are limited to a certain number of connections per host 
    # for downloading static files (css, js, images...)
    class UniqueAssetPath
      class << self
        # Builds the path to the file based on the name
        # 
{'fraction_non_alphanumeric': 0.1085650723025584, 'fraction_numerical': 0.0, 'mean_word_length': 2.146256123163051, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5200690', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1301, 'n_words': 419}