Following from my post: Array.acts_like_array?, I can now implement arrayify without using is_a? Array or respond_to? : && !is_a? String
class Object def arrayify self.acts_like?(:array) ? self : [self] end end
So we can now do: thing = thing.arrayify or: do_something(thing.arrayify)
Now, what I really want to do is thing.arrayify!, but I'm not sure how to implement that. Any ideas?