Sha256: 78ab0c830cea21271427c5096ab4020188c2ff88a695f83941e5880dcdf054c2
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Bridgetown class Slot using Bridgetown::Refinements include Transformable # @return [String] attr_reader :name # @return [String] attr_accessor :content # @return [Object, nil] attr_reader :context def initialize(name:, content:, context:, transform: false) @name, @content, @context = name, content, context Bridgetown::Hooks.trigger :slots, :pre_render, self transform! if transform Bridgetown::Hooks.trigger :slots, :post_render, self end def transform! self.content = transform_content(context, alternate_content: content) end private def converters # TODO: a private method calling another private method. Hmm. document_converters = context.is_a?(Bridgetown::Resource::Base) ? context.transformer.send(:converters) : context.send(:converters) document_converters.select { _1.class.supports_slots? } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-core-2.0.0.beta3 | lib/bridgetown-core/slot.rb |
bridgetown-core-2.0.0.beta2 | lib/bridgetown-core/slot.rb |
bridgetown-core-2.0.0.beta1 | lib/bridgetown-core/slot.rb |