Sha256: 921a6fc6331b841ba33d8e78b764215feff1db6c21e66b027d9717e580e050d2

Contents?: true

Size: 462 Bytes

Versions: 22

Compression:

Stored size: 462 Bytes

Contents

class Array
  #
  # The following is taken in whole from the extlib gem. Thanks y'all.
  #

  # 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

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
mrflip-wukong-0.1.0 lib/wukong/extensions/array.rb
wukong-3.0.0.pre old/wukong/extensions/array.rb
wukong-2.0.2 lib/wukong/extensions/array.rb
wukong-2.0.1 lib/wukong/extensions/array.rb
wukong-2.0.0 lib/wukong/extensions/array.rb
wukong-1.5.4 lib/wukong/extensions/array.rb
wukong-1.5.3 lib/wukong/extensions/array.rb
wukong-1.5.2 lib/wukong/extensions/array.rb
wukong-1.5.1 lib/wukong/extensions/array.rb
wukong-1.5.0 lib/wukong/extensions/array.rb
wukong-1.4.12 lib/wukong/extensions/array.rb
wukong-1.4.11 lib/wukong/extensions/array.rb
wukong-1.4.10 lib/wukong/extensions/array.rb
wukong-1.4.9 lib/wukong/extensions/array.rb
wukong-1.4.7 lib/wukong/extensions/array.rb
wukong-1.4.6 lib/wukong/extensions/array.rb
wukong-1.4.5 lib/wukong/extensions/array.rb
wukong-1.4.2 lib/wukong/extensions/array.rb
wukong-1.4.1 lib/wukong/extensions/array.rb
wukong-1.4.0 lib/wukong/extensions/array.rb