Class: Aspera::Cli::Result::Text
- Inherits:
-
Result
- Object
- Result
- Aspera::Cli::Result::Text
- Defined in:
- lib/aspera/cli/result.rb
Overview
Text result
Instance Method Summary collapse
- #format(formatter) ⇒ Object
-
#initialize(data) ⇒ Text
constructor
A new instance of Text.
Constructor Details
#initialize(data) ⇒ Text
Returns a new instance of Text.
195 196 197 198 |
# File 'lib/aspera/cli/result.rb', line 195 def initialize(data) Aspera.assert_type(data, *SCALAR_TYPES, type: ArgumentError) { 'text result data' } super(data: data) end |
Instance Method Details
#format(formatter) ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/aspera/cli/result.rb', line 200 def format(formatter) data = @data.is_a?(String) && formatter.hide_secrets? ? formatter.hide_secrets_in_string(@data) : @data case formatter.format_type when :text, :nagios formatter.(:data, data.to_s) when *STRUCTURED_FORMATS display_structured(formatter, data) when :table, :csv formatter.(:data, data) else super end end |