Sha256: 2ebc4a1aaa0ced71f90c1948d8f78c6bc85059e093c0e5297a240bb1ba31cb5c
Contents?: true
Size: 574 Bytes
Versions: 6
Compression:
Stored size: 574 Bytes
Contents
module InactiveSupport #:nodoc: module CoreExtensions #:nodoc: module Array #:nodoc: module ExtractOptions # Extract 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 end end end
Version data entries
6 entries across 6 versions & 2 rubygems