Method: Beaker::Options::Parser#split_arg
- Defined in:
- lib/beaker/options/parser.rb
#split_arg(arg) ⇒ Array
Normalizes argument into an Array. Argument can either be converted into an array of a single value, or can become an array of multiple values by splitting arg over ‘,’. If argument is already an array that array is returned untouched.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/beaker/options/parser.rb', line 48 def split_arg arg arry = [] if arg.is_a?(Array) arry += arg elsif arg =~ /,/ arry += arg.split(',') else arry << arg end arry end |