Module: Burner::Util::Arrayable
- Included in:
- Job
- Defined in:
- lib/burner/util/arrayable.rb
Overview
Provide helper methods for dealing with Arrays.
Instance Method Summary collapse
-
#array(value) ⇒ Object
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.
Instance Method Details
#array(value) ⇒ Object
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
21 22 23 24 25 26 27 |
# File 'lib/burner/util/arrayable.rb', line 21 def array(value) if value.is_a?(Hash) [value] else Array(value) end end |