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.
16
17
18
19
20
21
22
|
# File 'lib/bridgetown-core/slot.rb', line 16
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
11
12
13
|
# File 'lib/bridgetown-core/slot.rb', line 11
def content
@content
end
|
#context ⇒ Object?
14
15
16
|
# File 'lib/bridgetown-core/slot.rb', line 14
def context
@context
end
|
#name ⇒ String
8
9
10
|
# File 'lib/bridgetown-core/slot.rb', line 8
def name
@name
end
|
Instance Method Details
24
25
26
|
# File 'lib/bridgetown-core/slot.rb', line 24
def transform!
self.content = transform_content(context, alternate_content: content)
end
|