Method: Cork::Board#labeled
- Defined in:
- lib/cork/board.rb
#labeled(label, value, justification = 12) ⇒ Object
Prints a message with a label.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/cork/board.rb', line 137 def labeled(label, value, justification = 12) if value title = "- #{label}:" if value.is_a?(Enumerable) lines = [wrap_string(title, indentation_level)] lines += value.map do |v| wrap_string("- #{v}", indentation_level + 2) end puts lines.join("\n") else string = title.ljust(justification) + "#{value}" puts wrap_string(string, indentation_level) end end end |