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 ⇒ Flattener
constructor
A new instance of Flattener.
Constructor Details
#initialize ⇒ Flattener
Returns a new instance of Flattener.
17 18 19 |
# File 'lib/aspera/cli/formatter.rb', line 17 def initialize @result = nil end |
Instance Method Details
#config_over(something) ⇒ Object
Special method for configuration overview
30 31 32 33 34 35 36 37 38 |
# File 'lib/aspera/cli/formatter.rb', line 30 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
22 23 24 25 26 27 |
# File 'lib/aspera/cli/formatter.rb', line 22 def flatten(something) Aspera.assert_type(something, Hash) @result = {} flatten_any(something, '') return @result end |