Module: ATSD::Utils

Defined in:
lib/atsd/utils.rb,
lib/atsd/utils/camelize_keys.rb,
lib/atsd/utils/underscore_keys.rb

Defined Under Namespace

Modules: CamelizeKeys, UnderscoreKeys

Class Method Summary collapse

Class Method Details

.ensure_array(object) ⇒ Array

Ensures that object is an array

Parameters:

  • object (Object)

Returns:

  • (Array)


9
10
11
12
13
14
15
16
17
# File 'lib/atsd/utils.rb', line 9

def self.ensure_array(object)
  if object.nil?
    []
  elsif object.respond_to?(:to_ary)
    object.to_ary || [object]
  else
    [object]
  end
end