Class: RgGen::Core::InputBase::HashListParser

Inherits:
InputValueParser show all
Defined in:
lib/rggen/core/input_base/hash_list_parser.rb

Instance Method Summary collapse

Methods inherited from InputValueParser

#initialize

Constructor Details

This class inherits a constructor from RgGen::Core::InputBase::InputValueParser

Instance Method Details

#parse(input_value) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rggen/core/input_base/hash_list_parser.rb', line 7

def parse(input_value)
  list =
    if string?(input_value)
      split_string(input_value, /^\s*$/, 0)
    elsif hash?(input_value) && !input_value.empty?
      [input_value]
    else
      Array(input_value)
    end
  [list.map { |item| parse_hash(item, input_value) }]
end