Module: Hanami::Extensions::View::Context::InstanceMethods Private
- Defined in:
- lib/hanami/extensions/view/context.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #assets ⇒ Object private
- #content_for(key, value = nil, &block) ⇒ Object private
- #csrf_token ⇒ Object private
- #current_path ⇒ Object private
- #flash ⇒ Object private
- #inflector ⇒ Object private
- #initialize(**kwargs) ⇒ Object private
- #request ⇒ Object private
- #routes ⇒ Object private
- #session ⇒ Object private
- #settings ⇒ Object private
Instance Method Details
#assets ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 53 54 55 56 |
# File 'lib/hanami/extensions/view/context.rb', line 50 def assets unless [:assets] raise Hanami::ComponentLoadError, "hanami-assets gem is required to access assets" end [:assets] end |
#content_for(key, value = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/hanami/extensions/view/context.rb', line 58 def content_for(key, value = nil, &block) content = [:content] output = nil if block content[key] = yield elsif value content[key] = value else output = content[key] end output end |
#csrf_token ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
77 78 79 |
# File 'lib/hanami/extensions/view/context.rb', line 77 def csrf_token request.session[Hanami::Action::CSRFProtection::CSRF_TOKEN] end |
#current_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/hanami/extensions/view/context.rb', line 73 def current_path request.fullpath end |
#flash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
89 90 91 |
# File 'lib/hanami/extensions/view/context.rb', line 89 def flash response.flash end |
#inflector ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/hanami/extensions/view/context.rb', line 38 def inflector .fetch(:inflector) end |
#initialize(**kwargs) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 |
# File 'lib/hanami/extensions/view/context.rb', line 32 def initialize(**kwargs) defaults = {content: {}} super(**kwargs, **defaults) end |
#request ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 |
# File 'lib/hanami/extensions/view/context.rb', line 81 def request .fetch(:request) end |
#routes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/hanami/extensions/view/context.rb', line 42 def routes .fetch(:routes) end |
#session ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
85 86 87 |
# File 'lib/hanami/extensions/view/context.rb', line 85 def session request.session end |
#settings ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/hanami/extensions/view/context.rb', line 46 def settings .fetch(:settings) end |