Sha256: 73ab5abda577b852bdb27ce63696e05a50e7e1cc0262d2ed95571afebced9067
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
module AntSupport #:nodoc: module CoreExtensions #:nodoc: module Array #:nodoc: module ExtractOptions # 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ant-mapper-0.0.2 | ./lib/ant_support/core_ext/array/extract_options.rb |