Module: Cardboard::ContentForInControllers
- Included in:
- UrlController
- Defined in:
- lib/cardboard/helpers/content_for_in_controllers.rb
Instance Method Summary collapse
-
#content_for(name, content) ⇒ Object
no blocks allowed yet.
- #content_for?(name) ⇒ Boolean
- #view_context ⇒ Object
Instance Method Details
#content_for(name, content) ⇒ Object
no blocks allowed yet
11 12 13 14 15 16 17 18 |
# File 'lib/cardboard/helpers/content_for_in_controllers.rb', line 11 def content_for(name, content) # no blocks allowed yet @_content_for ||= {} if @_content_for[name].respond_to?(:<<) @_content_for[name] << content else @_content_for[name] = content end end |
#content_for?(name) ⇒ Boolean
19 20 21 |
# File 'lib/cardboard/helpers/content_for_in_controllers.rb', line 19 def content_for?(name) @_content_for[name].present? end |
#view_context ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/cardboard/helpers/content_for_in_controllers.rb', line 4 def view_context super.tap do |view| (@_content_for || {}).each do |name,content| view.content_for name, content end end end |