Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/http/cookie/ruby_compat.rb

Instance Method Summary collapse

Instance Method Details

#try_convert(object) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/http/cookie/ruby_compat.rb', line 21

def try_convert(object)
  if object.is_a?(Hash) ||
      (object.respond_to?(:to_hash) && (object = object.to_hash).is_a?(Hash))
    object
  else
    nil
  end
end