Sha256: 01ce97fcfa5435f0e175d2a715a0d602cef9ec5cc51ccf4512ee4fea7a523102

Contents?: true

Size: 417 Bytes

Versions: 2

Compression:

Stored size: 417 Bytes

Contents

# frozen_string_literal: true

# :nodoc:
class Hash
  # @api private
  def extractable_options?
    instance_of?(Hash)
  end
end

# :nodoc:
class Array
  # :nodoc:
  def extract_options!
    if last.is_a?(Hash) && last.extractable_options?
      pop
    else
      {}
    end
  end

  # :nodoc:
  def extract_options
    if last.is_a?(Hash) && last.extractable_options?
      last
    else
      {}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stub_requests-0.1.5 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.4 lib/stub_requests/core_ext/array/extract_options.rb