Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/confer/extensions/array.rb
Instance Method Summary collapse
-
#extract_options! ⇒ Object
Public: Removes and returns the last element of the Array if it is a Hash.
Instance Method Details
#extract_options! ⇒ Object
Public: Removes and returns the last element of the Array if it is a Hash.
Examples
array = ["one", "two", {three: 'four'}]
opts = array.
# => {three: 'four'}
array
# => ["one", "two"]
Returns the last element of the Array if it is a Hash, otherwise an empty hash is returned.
17 18 19 20 |
# File 'lib/confer/extensions/array.rb', line 17 def return pop if last.is_a?(Hash) {} end |