Open Blocks
The most versatile block of all is the open block. It allows you to apply block attributes to a chunk of text without giving it any other semantics. In other words, it provides a generic structural container for enclosing content. The only notable limitation is that an open block cannot be nested inside of another open block.
Open block syntax
Example 1. Open block syntax
--
An open block can be an anonymous container,
or it can masquerade as any other block.
--
The result of Example 1 is displayed below.
An open block can be an anonymous container, or it can masquerade as any other block.
An open block can act as any other block, with the exception of pass and table. For instance, in Example 2 an open block is acting as a sidebar.
The result of Example 2 is displayed below.
Example 3 is an open block acting as a source block.
Example 3. Open block masquerading as a source block
[source]
--
puts "I'm a source block!"
--
The result of Example 3 is displayed below.
puts "I'm a source block!"