class Froxy::LogSubscriber

Constants

EMPTY
VIEWS_PATTERN

Public Instance Methods

side_loaded_assets(event) click to toggle source
# File lib/froxy/log_subscriber.rb, line 9
def side_loaded_assets(event)
  return if (asset_types = event.payload[:asset_types]).empty?

  identifier_from_root = from_rails_root(event.payload[:identifier])

  info do
    message = +"  Side loaded #{asset_types.join(',')} for #{identifier_from_root}"
    message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
  end
end

Private Instance Methods

from_rails_root(string) click to toggle source
# File lib/froxy/log_subscriber.rb, line 23
def from_rails_root(string)
  string = string.sub(rails_root, EMPTY)
  string.sub!(VIEWS_PATTERN, EMPTY)
  string
end
rails_root() click to toggle source
# File lib/froxy/log_subscriber.rb, line 29
def rails_root
  @rails_root ||= "#{Rails.root}/"
end