<Toplevel Module>
ActiveSupport
—
#1
CoreExtensions
—
#2
Array
—
#3
ExtractOptions
—
#4
has properties |
|
1 module ActiveSupport #:nodoc: 2 module CoreExtensions #:nodoc: 3 module Array #:nodoc: 4 module ExtractOptions 5 # Extracts options from a set of arguments. Removes and returns the last 6 # element in the array if it's a hash, otherwise returns a blank hash. 7 # 8 # def options(*args) 9 # args.extract_options! 10 # end 11 # 12 # options(1, 2) # => {} 13 # options(1, 2, :a => :b) # => {:a=>:b} 14 def extract_options! 15 last.is_a?(::Hash) ? pop : {} 16 end 17 end 18 end 19 end 20 end