Sha256: 3c73289d15948758ec7fb7e4c4b12d5fe1c30754318f2c705ad277d05fbe8665

Contents?: true

Size: 1000 Bytes

Versions: 5

Compression:

Stored size: 1000 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/extension"

module Pakyow
  module Assets
    module Behavior
      # Silences asset requests from being logged.
      #
      module Silencing
        extend Support::Extension

        apply_extension do
          on "load" do
            if config.assets.silent
              # silence asset requests
              Pakyow.silence do |connection|
                # TODO: do we need the second check?
                connection.path.start_with?(config.assets.prefix) || self.class.asset.instances.any? { |asset|
                  asset.logical_path == connection.path
                }
              end

              # silence requests to public files
              Pakyow.silence do |connection|
                # TODO: really need an in-memory directory for these files
                File.file?(File.join(config.assets.public_path, connection.path))
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pakyow-assets-1.0.0.rc5 lib/pakyow/assets/behavior/silencing.rb
pakyow-assets-1.0.0.rc4 lib/pakyow/assets/behavior/silencing.rb
pakyow-assets-1.0.0.rc3 lib/pakyow/assets/behavior/silencing.rb
pakyow-assets-1.0.0.rc2 lib/pakyow/assets/behavior/silencing.rb
pakyow-assets-1.0.0.rc1 lib/pakyow/assets/behavior/silencing.rb