Browse Source

action_view displays items only from app/views

main
pvincent 3 months ago
parent
commit
2d52b98c4b
  1. 25
      lib/semantic/subscribers/action_view.rb

25
lib/semantic/subscribers/action_view.rb

@ -3,6 +3,8 @@ module Semantic
class ActionView < LogSubscriber
include AnsiColors
REGEX_BASEDIR = %r{^#{Rails.root}/(.*)}
attr_reader :logger
def initialize
@ -11,19 +13,34 @@ module Semantic
end
def render_partial(event)
# logger.info {'Rendered partial'}
identifier = pathname(event.payload[:identifier])
# logger.debug("Rendered partial #{identifier}", event.payload[:locals]) if identifier
logger.debug("Rendered partial #{identifier}") if identifier
end
def render_template(event)
logger.debug { 'Rendered template' }
layout = event.payload[:layout]
return unless layout
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered template #{identifier}" } if identifier
end
def render_collection(event)
logger.debug { 'Rendered collection' }
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered collection #{identifier}" } if identifier
end
def render_layout(event)
logger.debug { 'Rendered layout' }
identifier = pathname(event.payload[:identifier])
logger.debug { "Rendered layout #{identifier}" } if identifier
end
private
def pathname(location)
m = REGEX_BASEDIR.match(location)
m[1] if m
end
end
end

Loading…
Cancel
Save