Class: Aspera::Cli::Result::Special
- Inherits:
-
Result
- Object
- Result
- Aspera::Cli::Result::Special
- Defined in:
- lib/aspera/cli/result.rb
Overview
Base class for special results The type is automatically derived from the class name
Instance Method Summary collapse
- #format(formatter) ⇒ Object
-
#initialize ⇒ Special
constructor
A new instance of Special.
Constructor Details
#initialize ⇒ Special
Returns a new instance of Special.
94 95 96 97 98 |
# File 'lib/aspera/cli/result.rb', line 94 def initialize # Convert class name to symbol: Empty -> :empty, Nothing -> :nothing type = self.class.name.split('::').last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase.to_sym super(data: type) end |
Instance Method Details
#format(formatter) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/aspera/cli/result.rb', line 100 def format(formatter) case formatter.format_type when :text, :nagios, :ruby, :json, :jsonpp, :yaml formatter.(:data, @data.to_s) when :table, :csv if @data.eql?(:nothing) Log.log.debug('no result expected') return end formatter.(:info, formatter.special_format(@data.to_s)) else super end end |