Class: Bridgetown::Builders::PluginBuilder

Inherits:
Object
  • Object
show all
Includes:
DSL::Generators, DSL::HTTP, DSL::Helpers, DSL::Hooks, DSL::Liquid
Defined in:
lib/bridgetown-builder/plugin.rb

Direct Known Subclasses

Bridgetown::Builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL::Liquid

#liquid_filter, #liquid_tag

Methods included from DSL::HTTP

#connection, #get

Methods included from DSL::Hooks

#add_data, #hook

Methods included from DSL::Helpers

#helper

Methods included from DSL::Generators

#generator

Constructor Details

#initialize(name, current_site = nil) ⇒ PluginBuilder

Returns a new instance of PluginBuilder.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bridgetown-builder/plugin.rb', line 19

def initialize(name, current_site = nil)
  self.functions = Set.new
  self.name = name
  self.site = current_site || Bridgetown.sites.first

  self.config = if defined?(self.class::CONFIG_DEFAULTS)
                  Bridgetown::Utils.deep_merge_hashes(
                    self.class::CONFIG_DEFAULTS.with_dot_access, site.config
                  )
                else
                  site.config
                end
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



17
18
19
# File 'lib/bridgetown-builder/plugin.rb', line 17

def config
  @config
end

#functionsObject

Returns the value of attribute functions.



17
18
19
# File 'lib/bridgetown-builder/plugin.rb', line 17

def functions
  @functions
end

#nameObject

Returns the value of attribute name.



17
18
19
# File 'lib/bridgetown-builder/plugin.rb', line 17

def name
  @name
end

#siteObject

Returns the value of attribute site.



17
18
19
# File 'lib/bridgetown-builder/plugin.rb', line 17

def site
  @site
end

Instance Method Details

#doc(path, &block) ⇒ Object



37
38
39
# File 'lib/bridgetown-builder/plugin.rb', line 37

def doc(path, &block)
  DocumentsGenerator.add(path, block)
end

#inspectObject



33
34
35
# File 'lib/bridgetown-builder/plugin.rb', line 33

def inspect
  "#{name} (Hook)"
end