Module: Utilities::Params

Defined in:
lib/utilities/params.rb

Class Method Summary collapse

Class Method Details

.arrayify(value) ⇒ Array of symbols

Returns convert the value into an array of symbols.

Parameters:

  • value (String, Array, Symbol)

Returns:

  • (Array of symbols)

    convert the value into an array of symbols



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/utilities/params.rb', line 8

def self.arrayify(value)
  case value.class.name
  when 'Array'
    value.map(&:to_sym)
  when 'Symbol'
    [value]
  when 'String'
    [value.to_sym]
  else
    raise "value to arrayify() is not an Array, Symbol, or String"
  end
end