Class: HammerCLI::Output::Formatters::MultilineTextFormatter
Constant Summary
collapse
- INDENT =
' '.freeze
- MAX_WIDTH =
120
- MIN_WIDTH =
60
Instance Method Summary
collapse
inherited, #match?, #tags
Instance Method Details
195
196
197
198
199
|
# File 'lib/hammer_cli/output/formatters.rb', line 195
def format(text, field_params = {})
width = [[field_params.fetch(:width, 0), MIN_WIDTH].max, MAX_WIDTH].min
text.to_s.chars.each_slice(width).map(&:join).join("\n")
.indent_with(INDENT).prepend("\n")
end
|
#required_features ⇒ Object
189
190
191
192
193
|
# File 'lib/hammer_cli/output/formatters.rb', line 189
def required_features
return %i[serialized multiline rich_text] if tags.empty?
tags.map { |t| HammerCLI::Output::Utils.tag_to_feature(t) }
end
|