Class: Blacklight::Component

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
lib/blacklight/component.rb

Defined Under Namespace

Classes: EngineCompiler

Constant Summary collapse

EXCLUDE_VARIABLES =
[
  :@lookup_context, :@view_renderer, :@view_flow, :@view_context,
  :@tag_builder, :@current_template,
  :@__vc_set_slots, :@__vc_original_view_context,
  :@__vc_variant, :@__vc_content_evaluated,
  :@__vc_render_in_block, :@__vc_content, :@__vc_helpers
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compilerObject

rubocop:disable Naming/MemoizedInstanceVariableName



12
13
14
# File 'lib/blacklight/component.rb', line 12

def compiler
  @__vc_compiler ||= EngineCompiler.new(self)
end

.configObject



7
8
9
# File 'lib/blacklight/component.rb', line 7

def config
  @config ||= ViewComponent::Config.defaults.merge(ViewComponent::Base.config)
end

Instance Method Details

#inspectObject



28
29
30
31
32
33
# File 'lib/blacklight/component.rb', line 28

def inspect
  # Exclude variables added by render_in
  render_variables = instance_variables - EXCLUDE_VARIABLES
  fields = render_variables.map { |ivar| "#{ivar}:#{instance_variable_get(ivar).inspect}" }.join(', ')
  "#<#{self.class.name}:#{object_id} #{fields}>"
end