Sha256: c7f501fcb2f642e2cda0576bfaab61d7b558d3f35a62b24daef313dc67563ec7

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

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

# @see Array
# @api private
class Array
  # @api private
  def extract_options!
    if last.is_a?(Hash) && last.extractable_options?
      pop
    else
      {}
    end
  end

  # @api private
  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.3 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.2 lib/stub_requests/core_ext/array/extract_options.rb