Class: Bridgetown::Builders::PluginBuilder

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

Direct Known Subclasses

Bridgetown::Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DSL::Resources

#add_resource, #define_resource_method, #permalink_placeholder, #placeholder_processors, #resource

Methods included from DSL::Liquid

#filters, #filters_context, #liquid_filter, #liquid_tag

Methods included from DSL::HTTP

#connection, #get

Methods included from DSL::Inspectors

#inspect_html, #inspect_xml, process_html, process_xml, setup_nokogiri, setup_nokolexbor

Methods included from DSL::Hooks

#add_data, #hook

Methods included from DSL::Helpers

#helper, #helpers

Methods included from DSL::Generators

#generator

Constructor Details

#initialize(name = nil, current_site = nil) ⇒ PluginBuilder

Returns a new instance of PluginBuilder.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/bridgetown-builder/plugin.rb', line 40

def initialize(name = nil, current_site = nil)
  self.functions = Set.new
  self.name = name || self.class.name
  self.site = current_site || Bridgetown::Current.site

  self.config = if defined?(self.class::CONFIG_DEFAULTS)
                  Deprecator.deprecation_message(
                    "Using `CONFIG_DEFAULTS' in your builder is deprecated. " \
                    "Switch to defining config data via an initializer instead."
                  )
                  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.



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

def config
  @config
end

#functionsObject

Returns the value of attribute functions.



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

def functions
  @functions
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#siteObject

Returns the value of attribute site.



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

def site
  @site
end

Class Method Details

.plugin_registrationsObject



35
36
37
# File 'lib/bridgetown-builder/plugin.rb', line 35

def plugin_registrations
  @plugin_registrations ||= Set.new
end

Instance Method Details

#docObject

Raises:

  • (Bridgetown::Errors::FatalException)


58
59
60
61
# File 'lib/bridgetown-builder/plugin.rb', line 58

def doc(*)
  raise Bridgetown::Errors::FatalException,
        "The `doc' method has been removed. Please use the `new_resource' builder DSL instead"
end