class ObjectIdentifier::Identifier::ArrayWrap

ObjectIdentifier::Identifier::ArrayWrap mirrors the implementation of Rails' {Array.wrap} method. This allows us to get around objects that respond to `to_a` (such as Struct) and, instead, utilize either `to_ary` or just actually wrapping the object in an Array.

Public Class Methods

call(object) click to toggle source
# File lib/object_identifier/identifier.rb, line 150
def self.call(object)
  if object.nil?
    []
  elsif object.respond_to?(:to_ary)
    object.to_ary || [object]
  else
    [object]
  end
end