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 82 def content_for(key, value=nil, &block) 83 append = self.class.append_content_for? 84 85 if block || value 86 if block 87 value = capture_erb(&block) 88 end 89 90 @_content_for ||= {} 91 92 if append 93 (@_content_for[key] ||= []) << value 94 else 95 @_content_for[key] = value 96 end 97 elsif @_content_for && (value = @_content_for[key]) 98 if append 99 value = value.join 100 end 101 102 value 103 end 104 end