Class: Aspera::Cli::Flattener
- Inherits:
-
Object
- Object
- Aspera::Cli::Flattener
- 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
-
#config_over(something) ⇒ Object
Special method for configuration overview.
-
#flatten(something) ⇒ Object
General method.
-
#initialize(formatter) ⇒ Flattener
constructor
A new instance of Flattener.
Constructor Details
#initialize(formatter) ⇒ Flattener
19 20 21 22 |
# File 'lib/aspera/cli/formatter.rb', line 19 def initialize(formatter) @result = nil @formatter = formatter end |
Instance Method Details
#config_over(something) ⇒ Object
Special method for configuration overview
33 34 35 36 37 38 39 40 41 |
# File 'lib/aspera/cli/formatter.rb', line 33 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
25 26 27 28 29 30 |
# File 'lib/aspera/cli/formatter.rb', line 25 def flatten(something) Aspera.assert_type(something, Hash) @result = {} flatten_any(something, '') return @result end |