Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/lxa_core_extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#onlyObject



2
3
4
5
# File 'lib/lxa_core_extensions/array.rb', line 2

def only
  raise "called Array#only with array of length #{length}" if length != 1
  first
end

#random_elementObject



7
8
9
# File 'lib/lxa_core_extensions/array.rb', line 7

def random_element
  sample
end