Wednesday, 3 June 2009

Array.acts_like_array?

I've recently discovered the joys of: acts_like?, and was astounded that there hadn't been a simple extension to Array. So here's the monkeypatch:

# extension to allow us to check if an array is an array...
# This feeds the Object.acts_like? method
class Array
  def acts_like_array?
    true
  end
end

No comments: