Class: Array

Inherits:
Object show all
Defined in:
lib/array.rb,
lib/blank.rb

Overview

Extend the core Array class to include .wrap

Class Method Summary collapse

Class Method Details

.wrap(object) ⇒ Object

Duplication of Ruby on Rails Array#wrap method



6
7
8
9
10
11
12
13
14
# File 'lib/array.rb', line 6

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