class Sprockets::Rails::HelperAssetResolvers::Environment

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/sprockets/rails/helper.rbs

class Sprockets::Rails::HelperAssetResolvers::Environment
  def asset_path: (String path, true digest, ?nil allow_non_precompiled) -> String
  def digest_path: (String path, ?nil allow_non_precompiled) -> untyped
  def find_asset: (String path, ?Hash options) -> Sprockets::Asset
  def initialize: ((#<Class:0x0000000111724d88> | #<Class:0x000000010d743340>) view) -> void
  def precompiled?: (String path) -> true
  def raise_unless_precompiled_asset: (String path) -> nil
end

:nodoc:

def asset_path(path, digest, allow_non_precompiled = false)

Experimental RBS support (using type sampling data from the type_fusion project).

def asset_path: (String path, true digest, ?nil allow_non_precompiled) -> String

This signature was generated using 5 samples from 3 applications.

def asset_path(path, digest, allow_non_precompiled = false)
  # Digests enabled? Do the work to calculate the full asset path.
  if digest
    digest_path path, allow_non_precompiled
  # Otherwise, ask the Sprockets environment whether the asset exists
  # and check whether it's also precompiled for production deploys.
  elsif asset = find_asset(path)
    raise_unless_precompiled_asset asset.logical_path unless allow_non_precompiled
    path
  end
end

def digest_path(path, allow_non_precompiled = false)

Experimental RBS support (using type sampling data from the type_fusion project).

def digest_path: (String path, ?nil allow_non_precompiled) -> untyped

This signature was generated using 1 sample from 1 application.

def digest_path(path, allow_non_precompiled = false)
  if asset = find_asset(path)
    raise_unless_precompiled_asset asset.logical_path unless allow_non_precompiled
    asset.digest_path
  end
end

def find_asset(path, options = {})

Experimental RBS support (using type sampling data from the type_fusion project).

def find_asset: (String path, ? options) -> Sprockets::Asset

This signature was generated using 1 sample from 1 application.

def find_asset(path, options = {})
  @env[path, options]
end

def find_debug_asset(path)

def find_debug_asset(path)
  if asset = find_asset(path, pipeline: :debug)
    raise_unless_precompiled_asset asset.logical_path.sub('.debug', '')
    asset
  end
end

def initialize(view)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: ((#<Class:0x0000000111724d88> | #<Class:0x000000010d743340>) view) -> void

This signature was generated using 2 samples from 1 application.

:nodoc:
def initialize(view)
  raise ArgumentError, 'config.assets.resolve_with includes :environment, but app.assets is nil' unless view.assets_environment
  @env = view.assets_environment
  @precompiled_asset_checker = view.precompiled_asset_checker
  @check_precompiled_asset = view.check_precompiled_asset
end

def integrity(path)

def integrity(path)
  find_asset(path).try :integrity
end

def precompiled?(path)

Experimental RBS support (using type sampling data from the type_fusion project).

def precompiled?: (String path) -> true

This signature was generated using 6 samples from 3 applications.

def precompiled?(path)
  @precompiled_asset_checker.call path
end

def raise_unless_precompiled_asset(path)

Experimental RBS support (using type sampling data from the type_fusion project).

def raise_unless_precompiled_asset: (String path) -> nil

This signature was generated using 4 samples from 3 applications.

def raise_unless_precompiled_asset(path)
  raise Helper::AssetNotPrecompiledError.new(path) if @check_precompiled_asset && !precompiled?(path)
end