Module: Esse::ArrayUtils

Defined in:
lib/esse/primitives/array_utils.rb

Overview

The idea here is to add useful methods to the ruby standard objects without monkey patching them

Class Method Summary collapse

Class Method Details

.wrap(object) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/esse/primitives/array_utils.rb', line 7

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