Public Instance methods
content_for(key, value=nil, &block)
If called with a block, store content enclosed by block under the given key. If called without a block, retrieve stored content with the given key, or return nil if there is no content stored with that key.
[show source]
# File lib/roda/plugins/content_for.rb 77 def content_for(key, value=nil, &block) 78 append = opts[:append_content_for] 79 80 if block || value 81 if block 82 value = capture_erb(&block) 83 end 84 85 @_content_for ||= {} 86 87 if append 88 (@_content_for[key] ||= []) << value 89 else 90 @_content_for[key] = value 91 end 92 elsif @_content_for && (value = @_content_for[key]) 93 if append 94 value = value.join 95 end 96 97 value 98 end 99 end