Method: MetaModel::UserInterface.section
- Defined in:
- lib/metamodel/user_interface.rb
.section(title, verbose_prefix = '', relative_indentation = 0) ⇒ Object
TODO:
Refactor to title (for always visible titles like search) and sections (titles that represent collapsible sections).
Prints a title taking an optional verbose prefix and a relative indentation valid for the UI action in the passed block.
In verbose mode titles are printed with a color according to their level. In normal mode titles are printed only if they have nesting level smaller than 2.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/metamodel/user_interface.rb', line 51 def section(title, verbose_prefix = '', relative_indentation = 0) if config.verbose? title(title, verbose_prefix, relative_indentation) elsif title_level < 1 puts title end self.indentation_level += relative_indentation self.title_level += 1 yield if block_given? self.indentation_level -= relative_indentation self.title_level -= 1 end |