Class: Racket::Plugins::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/racket/plugins/base.rb

Overview

Plugin base class. All plugins should inherit from this class.

Direct Known Subclasses

Sass

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings = {}) ⇒ Base

Returns a new instance of Base.



26
27
28
29
# File 'lib/racket/plugins/base.rb', line 26

def initialize(settings = {})
  @settings = {}
  @settings.merge!(settings) if settings.is_a?(Hash)
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



24
25
26
# File 'lib/racket/plugins/base.rb', line 24

def settings
  @settings
end

Instance Method Details

#default_controller_helpersArray

This method should return an array of helpers (symbols) that the plugin wants to load automatically in every controller. If you do not want your controller to load any helpers automatically you do not need to override this method. You can still add your helpers to individual controllers by using Controller#helper.

Returns:

  • (Array)

    An array of symbols representing helpers that should be loaded automatically



37
38
39
# File 'lib/racket/plugins/base.rb', line 37

def default_controller_helpers
  []
end

#middlewareArray

This method should return an array of [Module, Hash] arrays where each module represenents a Rack-compatible middleware module and the hash the settings that should be applied to that middleware. Each pair that the plugin provides will be automatically added to the middleware of the application. This is just for conveniance, a user could still add The same middleware using the global settings.

Returns:

  • (Array)

    An array of [Module, Hash] pairs that represenents middleware that will be loaded automatically by the plugin



49
50
51
# File 'lib/racket/plugins/base.rb', line 49

def middleware
  []
end