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