Class: Racket::Plugins::Base
- Inherits:
-
Object
- Object
- Racket::Plugins::Base
- Defined in:
- lib/racket/plugins/base.rb
Overview
Plugin base class. All plugins should inherit from this class.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#default_controller_helpers ⇒ Array
This method should return an array of helpers (symbols) that the plugin wants to load automatically in every controller.
-
#initialize(settings = {}) ⇒ Base
constructor
A new instance of Base.
-
#middleware ⇒ Array
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.
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
#settings ⇒ Object (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_helpers ⇒ Array
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.
37 38 39 |
# File 'lib/racket/plugins/base.rb', line 37 def default_controller_helpers [] end |
#middleware ⇒ Array
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.
49 50 51 |
# File 'lib/racket/plugins/base.rb', line 49 def middleware [] end |