Sha256: f9c78d74982064e070c1015bf80ee4b1385fbd9184dd6169668f689f9db7dd57

Contents?: true

Size: 191 Bytes

Versions: 2

Compression:

Stored size: 191 Bytes

Contents

class Array
  class ExpectedOneElementError < StandardError; end

  # To make sanity checking a bit easier.
  def only
    raise ExpectedOneElementError unless count == 1
    first
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
junk_drawer-0.0.2 lib/core_extensions/array.rb
junk_drawer-0.0.1 lib/core_extensions/array.rb