Sha256: 17b36a5ca51c8535c822d3824c638047516f7ed0008304ed8a89e882d081d884

Contents?: true

Size: 341 Bytes

Versions: 8

Compression:

Stored size: 341 Bytes

Contents

module Esse
  # The idea here is to add useful methods to the ruby standard objects without
  # monkey patching them
  module ArrayUtils
    module_function

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
esse-0.4.0.rc4 lib/esse/primitives/array_utils.rb
esse-0.4.0.rc3 lib/esse/primitives/array_utils.rb
esse-0.4.0.rc2 lib/esse/primitives/array_utils.rb
esse-0.4.0.rc1 lib/esse/primitives/array_utils.rb
esse-0.3.5 lib/esse/primitives/array_utils.rb
esse-0.3.4 lib/esse/primitives/array_utils.rb
esse-0.3.3 lib/esse/primitives/array_utils.rb
esse-0.3.2 lib/esse/primitives/array_utils.rb