Module: ContentForRails
- Defined in:
- lib/content_for_rails.rb,
lib/content_for_rails/version.rb
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
Instance Method Details
#content_for(name, content) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/content_for_rails.rb', line 10 def content_for(name, content) @_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/content_for_rails.rb', line 19 def content_for?(name) @_content_for[name].present? end |
#view_context ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/content_for_rails.rb', line 2 def view_context super.tap do |view| (@_content_for || {}).each do |name, content| view.content_for name, content end end end |