Class: RgGen::Core::InputBase::OptionArrayParser

Inherits:
InputValueParser show all
Defined in:
lib/rggen/core/input_base/option_array_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
# File 'lib/rggen/core/input_base/option_array_parser.rb', line 7

def parse(input_value)
  value, options =
    if string?(input_value)
      parse_string_value(input_value)
    else
      Array(input_value).then { |v| [v.first, v[1..]] }
    end
  [value, options || []]
end