Module: Storytime::Concerns::ControllerContentFor
- Included in:
- ApplicationController
- Defined in:
- lib/storytime/concerns/controller_content_for.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
13 14 15 16 17 18 19 20 |
# File 'lib/storytime/concerns/controller_content_for.rb', line 13 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
22 23 24 |
# File 'lib/storytime/concerns/controller_content_for.rb', line 22 def content_for?(name) @_content_for[name].present? end |
#view_context ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/storytime/concerns/controller_content_for.rb', line 5 def view_context super.tap do |view| (@_content_for || {}).each do |name,content| view.content_for name, content end end end |