Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / array / extract_options.rb
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