Class: Bridgetown::Builder
Overview
Superclass for a website’s SiteBuilder abstract class
Instance Attribute Summary
#config, #functions, #name, #site
Class Method Summary
collapse
Instance Method Summary
collapse
#doc
#liquid_filter, #liquid_tag
#connection, #get
#add_data, #hook
#helper
#generator
Constructor Details
#initialize(name, current_site = nil) ⇒ Builder
Subclass is expected to implement #build
15
16
17
18
|
# File 'lib/bridgetown-builder/builder.rb', line 15
def initialize(name, current_site = nil)
super(name, current_site)
build
end
|
Class Method Details
.catch_inheritance(const) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/bridgetown-builder/builder.rb', line 31
def self.catch_inheritance(const)
const.define_singleton_method :inherited do |const_|
(@children ||= Set.new).add const_
yield const_ if block_given?
end
end
|
.descendants ⇒ Object
38
39
40
41
42
43
|
# File 'lib/bridgetown-builder/builder.rb', line 38
def self.descendants
@children ||= Set.new
out = @children.map(&:descendants)
out << self unless ["SiteBuilder", "Bridgetown::Builder"].include?(name)
Set.new(out).flatten
end
|
.inherited(const) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/bridgetown-builder/builder.rb', line 24
def self.inherited(const)
(@children ||= Set.new).add const
catch_inheritance(const) do |const_|
catch_inheritance(const_)
end
end
|
.register ⇒ Object
7
8
9
10
11
|
# File 'lib/bridgetown-builder/builder.rb', line 7
def register
Bridgetown::Hooks.register_one :site, :pre_read, reloadable: false do |site|
new(name, site)
end
end
|
Instance Method Details
#inspect ⇒ Object
20
21
22
|
# File 'lib/bridgetown-builder/builder.rb', line 20
def inspect
name
end
|