Class: Bridgetown::Slot
Instance Attribute Summary collapse
Instance Method Summary
collapse
#transform_content, #transform_with_layout
Constructor Details
#initialize(name:, content:, context:, transform: false) ⇒ Slot
Returns a new instance of Slot.
18
19
20
21
22
23
24
|
# File 'lib/bridgetown-core/slot.rb', line 18
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
|
Instance Attribute Details
#content ⇒ String
13
14
15
|
# File 'lib/bridgetown-core/slot.rb', line 13
def content
@content
end
|
#context ⇒ Object?
16
17
18
|
# File 'lib/bridgetown-core/slot.rb', line 16
def context
@context
end
|
#name ⇒ String
10
11
12
|
# File 'lib/bridgetown-core/slot.rb', line 10
def name
@name
end
|
Instance Method Details
26
27
28
|
# File 'lib/bridgetown-core/slot.rb', line 26
def transform!
self.content = transform_content(context, alternate_content: content)
end
|