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.



133
134
135
# File 'lib/hammer_cli/output/formatters.rb', line 133

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

Instance Method Details

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



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

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

#tagsObject



137
138
139
# File 'lib/hammer_cli/output/formatters.rb', line 137

def tags
  [:screen]
end