Sha256: ffcdcce91e05fb03b42c622cf66f675a1d635d1760bbf0cd8cf99a9870f19e4d
Contents?: true
Size: 382 Bytes
Versions: 11
Compression:
Stored size: 382 Bytes
Contents
class Array # Extracts options from a set of arguments. Removes and returns the last # element in the array if it's a hash, otherwise returns a blank hash. # # def options(*args) # args.extract_options! # end # # options(1, 2) # => {} # options(1, 2, :a => :b) # => {:a=>:b} def extract_options! last.is_a?(::Hash) ? pop : {} end end
Version data entries
11 entries across 11 versions & 4 rubygems