Class: HammerCLI::Output::Formatters::LongTextFormatter

Inherits:
FieldFormatter
  • Object
show all
Defined in:
lib/hammer_cli/output/formatters.rb

Constant Summary collapse

INDENT =
"  "

Instance Method Summary collapse

Methods inherited from FieldFormatter

#match?

Constructor Details

#initialize(options = {}) ⇒ LongTextFormatter

Returns a new instance of LongTextFormatter.



139
140
141
# File 'lib/hammer_cli/output/formatters.rb', line 139

def initialize(options = {})
  @indent = options[:indent].nil? ? true : options[:indent]
end

Instance Method Details

#format(text, field_params = {}) ⇒ Object



147
148
149
150
# File 'lib/hammer_cli/output/formatters.rb', line 147

def format(text, field_params={})
  text = text.to_s.indent_with(INDENT) if @indent
  "\n#{text}"
end

#tagsObject



143
144
145
# File 'lib/hammer_cli/output/formatters.rb', line 143

def tags
  [:screen]
end