Sha256: 7a718a006dabee9983b8371f74307acfa50cce8b79319dea52105f73a0da2dee

Contents?: true

Size: 546 Bytes

Versions: 6

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stub_requests-0.1.11 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.10 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.9 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.8 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.7 lib/stub_requests/core_ext/array/extract_options.rb
stub_requests-0.1.6 lib/stub_requests/core_ext/array/extract_options.rb