Class: Wurk::Web::Extension::App
- Inherits:
-
Object
- Object
- Wurk::Web::Extension::App
- Defined in:
- lib/wurk/web/extension.rb
Overview
Captures the routes + helpers an extension declares in ‘registered`. Quacks like the slice of `Sidekiq::Web::Application` extensions touch.
Constant Summary collapse
- HTTP_METHODS =
%i[get post put patch delete head].freeze
Instance Attribute Summary collapse
-
#helper_blocks ⇒ Object
readonly
Returns the value of attribute helper_blocks.
-
#helper_modules ⇒ Object
readonly
Returns the value of attribute helper_modules.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #configure ⇒ Object
-
#helpers(*mods, &block) ⇒ Object
Sidekiq extensions add helpers via ‘app.helpers(Mod)` and/or a block.
-
#initialize ⇒ App
constructor
A new instance of App.
-
#set ⇒ Object
Sinatra settings calls some extensions make — accepted no-op.
- #settings ⇒ Object
Constructor Details
#initialize ⇒ App
Returns a new instance of App.
31 32 33 34 35 |
# File 'lib/wurk/web/extension.rb', line 31 def initialize @routes = [] # [[method_string, Route, block], …] @helper_modules = [] @helper_blocks = [] end |
Instance Attribute Details
#helper_blocks ⇒ Object (readonly)
Returns the value of attribute helper_blocks.
27 28 29 |
# File 'lib/wurk/web/extension.rb', line 27 def helper_blocks @helper_blocks end |
#helper_modules ⇒ Object (readonly)
Returns the value of attribute helper_modules.
27 28 29 |
# File 'lib/wurk/web/extension.rb', line 27 def helper_modules @helper_modules end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
27 28 29 |
# File 'lib/wurk/web/extension.rb', line 27 def routes @routes end |
Instance Method Details
#configure ⇒ Object
53 |
# File 'lib/wurk/web/extension.rb', line 53 def configure(*) = (yield self if block_given?) |
#helpers(*mods, &block) ⇒ Object
Sidekiq extensions add helpers via ‘app.helpers(Mod)` and/or a block.
44 45 46 47 48 |
# File 'lib/wurk/web/extension.rb', line 44 def helpers(*mods, &block) @helper_modules.concat(mods) @helper_blocks << block if block self end |
#set ⇒ Object
Sinatra settings calls some extensions make — accepted no-op.
51 |
# File 'lib/wurk/web/extension.rb', line 51 def set(*); end |
#settings ⇒ Object
52 |
# File 'lib/wurk/web/extension.rb', line 52 def settings = self |