Class: Aspera::Cli::Flattener

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/cli/formatter.rb

Overview

This class is used to transform a complex structure into a simple hash

Instance Method Summary collapse

Constructor Details

#initialize(formatter) ⇒ Flattener

Returns a new instance of Flattener.



20
21
22
23
# File 'lib/aspera/cli/formatter.rb', line 20

def initialize(formatter)
  @result = nil
  @formatter = formatter
end

Instance Method Details

#config_over(something) ⇒ Object

Special method for configuration overview



34
35
36
37
38
39
40
41
42
# File 'lib/aspera/cli/formatter.rb', line 34

def config_over(something)
  @result = []
  something.each do |config, preset|
    preset.each do |parameter, value|
      @result.push(CONF_OVERVIEW_KEYS.zip([config, parameter, value]).to_h)
    end
  end
  return @result
end

#flatten(something) ⇒ Object

General method



26
27
28
29
30
31
# File 'lib/aspera/cli/formatter.rb', line 26

def flatten(something)
  Aspera.assert_type(something, Hash)
  @result = {}
  flatten_any(something, '')
  return @result
end