module Burner::Util::Arrayable

Provide helper methods for dealing with Arrays.

Public Instance Methods

array(value) click to toggle source

Since Ruby's Kernel#Array will properly call to_a for scalar Hash objects, this could return something funky in the context of this library. In this library, Hash instances are typically viewed as an atomic key-value-based “object”. This library likes to deal with object-like things, treating Hash, OpenStruct, Struct, or Object subclasses as basically the same thing. In this vein, this library leverages Objectable to help unify access data from objects. See the Objectable library for more information: github.com/bluemarblepayroll/objectable

# File lib/burner/util/arrayable.rb, line 21
def array(value)
  if value.is_a?(Hash)
    [value]
  else
    Array(value)
  end
end